⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbd::oracle.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 5 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Oracle 3".TH Oracle 3 "2007-12-11" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"DBD::Oracle \- Oracle database driver for the DBI module.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 1\&  use DBI;\&\&  $dbh = DBI\->connect("dbi:Oracle:$dbname", $user, $passwd);\&\&  $dbh = DBI\->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passwd);\&\&  # See the DBI module documentation for full details\&\&  # for some advanced uses you may need Oracle type values:\&  use DBD::Oracle qw(:ora_types);.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"DBD::Oracle is a Perl module which works with the \s-1DBI\s0 module to provideaccess to Oracle databases..SH "CONNECTING TO ORACLE".IX Header "CONNECTING TO ORACLE"This is a topic which often causes problems. Mainly due to Oracle's manyand sometimes complex ways of specifying and connecting to databases.(James Taylor and Lane Sharman have contributed much of the text inthis section.).Sh "Connecting without environment variables or tnsnames.ora file".IX Subsection "Connecting without environment variables or tnsnames.ora file"If you use the \f(CW\*(C`host=$host;sid=$sid\*(C'\fR style syntax, for example:.PP.Vb 1\&  $dbh = DBI\->connect("dbi:Oracle:host=myhost.com;sid=ORCL", $user, $passwd);.Ve.PPthen DBD::Oracle will construct a full connection descriptor stringfor you and Oracle will not need to consult the tnsnames.ora file..PPIf a \f(CW\*(C`port\*(C'\fR number is not specified then the descriptor will try both1526 and 1521 in that order (e.g., new then old).  You can check whichport(s) are in use by typing \*(L"$ORACLE_HOME/bin/lsnrctl stat\*(R" on the server..Sh "Oracle Environment Variables".IX Subsection "Oracle Environment Variables"Oracle typically uses two environment variables to specify defaultconnections: \s-1ORACLE_SID\s0 and \s-1TWO_TASK\s0..PP\&\s-1ORACLE_SID\s0 is really unnecessary to set since \s-1TWO_TASK\s0 provides thesame functionality in addition to allowing remote connections..PP.Vb 2\&  % setenv TWO_TASK T:hostname:ORACLE_SID            # for csh shell\&  $ TWO_TASK=T:hostname:ORACLE_SID export TWO_TASK   # for sh shell\&\&  % sqlplus username/password.Ve.PPNote that if you have *both* local and remote databases, and youhave \s-1ORACLE_SID\s0 *and* \s-1TWO_TASK\s0 set, and you don't specify a fullyqualified connect string on the command line, \s-1TWO_TASK\s0 takes precedenceover \s-1ORACLE_SID\s0 (i.e. you get connected to remote system)..PP.Vb 1\&  TWO_TASK=P:sid.Ve.PPwill use the pipe driver for local connections using SQL*Net v1..PP.Vb 1\&  TWO_TASK=T:machine:sid.Ve.PPwill use \s-1TCP/IP\s0 (or D for \s-1DECNET\s0, etc.) for remote SQL*Net v1 connection..PP.Vb 1\&  TWO_TASK=dbname.Ve.PPwill use the info stored in the SQL*Net v2 \fItnsnames.ora\fRconfiguration file for local or remote connections..PPThe \s-1ORACLE_HOME\s0 environment variable should be set correctly.In general, the value used should match the version of Oracle thatwas used to build DBD::Oracle.  If using dynamic linking then\&\s-1ORACLE_HOME\s0 should match the version of Oracle that will be usedto load in the Oracle client libraries (via \s-1LD_LIBRARY_PATH\s0, ldconfig,or similar on Unix)..PP\&\s-1ORACLE_HOME\s0 can be left unset if you aren't using any of Oracle'sexecutables, but it is \fInot\fR recommended and error messages may not display.It should be set to the \s-1ORACLE_HOME\s0 directory of the version of Oraclethat DBD::Oracle was compiled with..PPDiscouraging the use of \s-1ORACLE_SID\s0 makes it easier on the users to seewhat is going on. (It's unfortunate that \s-1TWO_TASK\s0 couldn't be renamed,since it makes no sense to the end user, and doesn't have the \s-1ORACLE\s0 prefix)..Sh "Connection Examples Using DBD::Oracle".IX Subsection "Connection Examples Using DBD::Oracle"First, how to connect to a local database \fIwithout\fR using a Listener:.PP.Vb 1\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:SID\*(Aq,\*(Aqscott\*(Aq, \*(Aqtiger\*(Aq);.Ve.PPyou can also leave the \s-1SID\s0 empty:.PP.Vb 1\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:\*(Aq,\*(Aqscott\*(Aq, \*(Aqtiger\*(Aq);.Ve.PPin which case Oracle client code will use the \s-1ORACLE_SID\s0 environmentvariable (if \s-1TWO_TASK\s0 env var isn't defined)..PPBelow are various ways of connecting to an oracle database usingSQL*Net 1.x and SQL*Net 2.x.  \*(L"Machine\*(R" is the computer the database isrunning on, \*(L"\s-1SID\s0\*(R" is the \s-1SID\s0 of the database, \*(L"\s-1DB\s0\*(R" is the SQL*Net 2.xconnection descriptor for the database..PP\&\fBNote:\fR Some of these formats may not work with Oracle 8+..PP.Vb 7\&  BEGIN {\&     $ENV{ORACLE_HOME} = \*(Aq/home/oracle/product/7.x.x\*(Aq;\&     $ENV{TWO_TASK}    = \*(AqDB\*(Aq;\&  }\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:\*(Aq,\*(Aqscott\*(Aq, \*(Aqtiger\*(Aq);\&  #  \- or \-\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:\*(Aq,\*(Aqscott/tiger\*(Aq);.Ve.PPRefer to your Oracle documentation for valid values of \s-1TWO_TASK\s0..PPHere are some variations (not setting \s-1TWO_TASK\s0) in order of preference:.PP.Vb 1\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:DB\*(Aq,\*(Aqusername\*(Aq,\*(Aqpassword\*(Aq)\&\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:DB\*(Aq,\*(Aqusername/password\*(Aq,\*(Aq\*(Aq)\&\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:\*(Aq,\*(Aqusername@DB\*(Aq,\*(Aqpassword\*(Aq)\&\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:host=foobar;sid=ORCL;port=1521\*(Aq, \*(Aqscott/tiger\*(Aq, \*(Aq\*(Aq)\&\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:\*(Aq, q{scott/tiger@(DESCRIPTION=\&  (ADDRESS=(PROTOCOL=TCP)(HOST= foobar)(PORT=1521))\&  (CONNECT_DATA=(SID=ORCL)))}, "").Ve.PPIf you are having problems with login taking a long time (>10 secs say)then you might have tripped up on an Oracle bug. You can try using oneof the ...@DB variants as a workaround. E.g.,.PP.Vb 1\&  $dbh = DBI\->connect(\*(Aq\*(Aq,\*(Aqusername/password@DB\*(Aq,\*(Aq\*(Aq);.Ve.PPOn the other hand, that may cause you to trip up on another Oracle bugthat causes alternating connection attempts to fail! (In reality onlya small proportion of people experience these problems.).PPTo connect to a local database with a user which has been set-up toauthenticate via the \s-1OS\s0 (\*(L"\s-1ALTER\s0 \s-1USER\s0 username \s-1IDENTIFIED\s0 \s-1EXTERNALLY\s0\*(R"):.PP.Vb 1\&  $dbh = DBI\->connect(\*(Aqdbi:Oracle:\*(Aq,\*(Aq/\*(Aq,\*(Aq\*(Aq);.Ve.PPNote the lack of a connection name (use the \s-1ORACLE_SID\s0 environmentvariable). If an explicit \s-1SID\s0 is used you'll probably get an \s-1ORA\-01004\s0 error..PPThat only works for local databases. (Authentication to remote Oracledatabases using your unix login name without a password and is possiblebut it's not secure and not recommended so not documented here. If youcan't find the information elsewhere then you probably shouldn't betrying to do it.).Sh "Optimizing Oracle's listener".IX Subsection "Optimizing Oracle's listener"[By Lane Sharman <lane@bienlogic.com>] I spent a \s-1LOT\s0 of time optimizinglistener.ora and I am including it here for anyone to benefit from. Myconnections over tnslistener on the same humble Netra 1 take an averageof 10\-20 milli seconds according to tnsping. If anyone knows how tomake it better, please let me know!.PP.Vb 9\& LISTENER =\&  (ADDRESS_LIST =\&    (ADDRESS =\&      (PROTOCOL = TCP)\&      (Host = aa.bbb.cc.d)\&      (Port = 1521)\&      (QUEUESIZE=10)\&    )\&  )\&\& STARTUP_WAIT_TIME_LISTENER = 0\& CONNECT_TIMEOUT_LISTENER = 10\& TRACE_LEVEL_LISTENER = OFF\& SID_LIST_LISTENER =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -