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

📄 dbd::oracle.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 5 页
字号:
\&  (SID_LIST =\&    (SID_DESC =\&      (SID_NAME = xxxx)\&      (ORACLE_HOME = /xxx/local/oracle7\-3)\&        (PRESPAWN_MAX = 40)\&        (PRESPAWN_LIST=\&        (PRESPAWN_DESC=(PROTOCOL=tcp) (POOL_SIZE=40) (TIMEOUT=120))\&      )\&    )\&  ).Ve.PP1) When the application is co-located on the host \s-1AND\s0 there is no need foroutside SQLNet connectivity, stop the listener. You do not need it. Getyour application/cgi/whatever working using pipes and shared memory. I amconvinced that this is one of the connection bugs (sockets over the samemachine). Note the \f(CW$ENV\fR{\s-1ORAPIPES\s0} env var.  The essential code to dothis at the end of this section..PP2) Be careful in how you implement the multi-threaded server. Currently Iam not using it in the initxxxx.ora file but will be doing some more testing..PP3) Be sure to create user rollback segments and use them; do not use thesystem rollback segments; however, you must also create a small rollbackspace for the system as well..PP5) Use large tuning settings and get lots of \s-1RAM\s0. Check out all theparameters you can set in v$parameters because there are quite a few notdocumented you may to set in your initxxx.ora file..PP6) Use svrmgrl to control oracle from the command line. Write lots of small\&\s-1SQL\s0 scripts to get at V$ info..PP.Vb 11\&  use DBI;\&  # Environmental variables used by Oracle\&  $ENV{ORACLE_SID}   = "xxx";\&  $ENV{ORACLE_HOME}  = "/opt/oracle7";\&  $ENV{EPC_DISABLED} = "TRUE";\&  $ENV{ORAPIPES} = "V2";\&  my $dbname = "xxx";\&  my $dbuser = "xxx";\&  my $dbpass = "xxx";\&  my $dbh = DBI\->connect("dbi:Oracle:$dbname", $dbuser, $dbpass)\&             || die "Unable to connect to $dbname: $DBI::errstr\en";.Ve.Sh "Oracle utilities".IX Subsection "Oracle utilities"If you are still having problems connecting then the Oracle adaptersutility may offer some help. Run these two commands:.PP.Vb 2\&  $ORACLE_HOME/bin/adapters\&  $ORACLE_HOME/bin/adapters $ORACLE_HOME/bin/sqlplus.Ve.PPand check the output. The \*(L"Protocol Adapters\*(R" section should be thesame.  It should include at least \*(L"\s-1IPC\s0 Protocol Adapter\*(R" and \*(L"\s-1TCP/IP\s0Protocol Adapter\*(R"..PPIf it generates any errors which look relevant then please talk to yourOracle technical support (and not the dbi-users mailing list). Thanks.Thanks to Mark Dedlow for this information..Sh "Constants".IX Subsection "Constants".IP ":ora_session_modes" 4.IX Item ":ora_session_modes".Vb 1\&  ORA_SYSDBA ORA_SYSOPER.Ve.IP ":ora_types" 4.IX Item ":ora_types".Vb 4\&  ORA_VARCHAR2 ORA_STRING ORA_NUMBER ORA_LONG ORA_ROWID ORA_DATE\&  ORA_RAW ORA_LONGRAW ORA_CHAR ORA_CHARZ ORA_MLSLABEL ORA_NTY\&  ORA_CLOB ORA_BLOB ORA_RSET ORA_VARCHAR2_TABLE ORA_NUMBER_TABLE\&  SQLT_INT SQLT_FLT.Ve.IP "\s-1SQLCS_IMPLICIT\s0" 4.IX Item "SQLCS_IMPLICIT".PD 0.IP "\s-1SQLCS_NCHAR\s0" 4.IX Item "SQLCS_NCHAR".PD\&\s-1SQLCS_IMPLICIT\s0 and \s-1SQLCS_NCHAR\s0 are \fIcharacter set form\fR values.See notes about Unicode elsewhere in this document..IP "\s-1SQLT_INT\s0" 4.IX Item "SQLT_INT".PD 0.IP "\s-1SQLT_FLT\s0" 4.IX Item "SQLT_FLT".PDThese types are used only internally, and may be specified as internalbind type for \s-1ORA_NUMBER_TABLE\s0. See notes about \s-1ORA_NUMBER_TABLE\s0 elsewherein this document.IP "\s-1ORA_OCI\s0" 4.IX Item "ORA_OCI"Oracle doesn't provide a formal \s-1API\s0 for determining the exact versionnumber of the \s-1OCI\s0 client library used, so DBD::Oracle has to go digging(and sometimes has to more or less guess).  The \s-1ORA_OCI\s0 constantholds the result of that process..SpIn string context \s-1ORA_OCI\s0 returns the full \*(L"A.B.C.D\*(R" version string..SpIn numeric context \s-1ORA_OCI\s0 returns the major.minor version number(8.1, 9.2, 10.0 etc).  But note that version numbers are not actuallyfloating point and so if Oracle ever makes a release that has a twodigit minor version, such as \f(CW9.10\fR it will have a lower numericvalue than the preceding \f(CW9.9\fR release. So use with care..SpThe contents and format of \s-1ORA_OCI\s0 are subject to change (it may,for example, become a \fIversion object\fR in later releases).I recommend that you avoid checking for exact values..Sh "Connect Attributes".IX Subsection "Connect Attributes".IP "ora_session_mode" 4.IX Item "ora_session_mode"The ora_session_mode attribute can be used to connect with \s-1SYSDBA\s0authorization and \s-1SYSOPER\s0 authorization.The \s-1ORA_SYSDBA\s0 and \s-1ORA_SYSOPER\s0 constants can be imported using.Sp.Vb 1\&  use DBD::Oracle qw(:ora_session_modes);.Ve.SpThis is one case where setting \s-1ORACLE_SID\s0 may be useful sinceconnecting as \s-1SYSDBA\s0 or \s-1SYSOPER\s0 via SQL*Net is frequently disabledfor security reasons..SpExample:.Sp.Vb 3\&  $dsn = "dbi:Oracle:";       # no dbname here\&  $ENV{ORACLE_SID} = "orcl";  # set ORACLE_SID as needed\&  delete $ENV{TWO_TASK};      # make sure TWO_TASK isn\*(Aqt set\&\&  $dbh = DBI\->connect($dsn, "", "", { ora_session_mode => ORA_SYSDBA });.Ve.SpIt has been reported that this only works if \f(CW$dsn\fR does not contain a \s-1SID\s0so that Oracle then uses the value of the \s-1ORACLE_SID\s0 (not \s-1TWO_TASK\s0)environment variable to connect to a local instance. Also the usernameand password should be empty, and the user executing the script needsto be part of the dba group or osdba group..IP "ora_oratab_orahome" 4.IX Item "ora_oratab_orahome"Passing a true value for the ora_oratab_orahome attribute will makeDBD::Oracle change \f(CW$ENV\fR{\s-1ORACLE_HOME\s0} to make the Oracle home directoryspecified in the \f(CW\*(C`/etc/oratab\*(C'\fR file \fIif\fR the database to connect tois specified as a \s-1SID\s0 that exists in the oratab file, and DBD::Oracle wasbuilt to use the Oracle 7 \s-1OCI\s0 \s-1API\s0 (not Oracle 8+)..IP "ora_module_name" 4.IX Item "ora_module_name"After connecting to the database the value of this attribute is passedto the \s-1\fISET_MODULE\s0()\fR function in the \f(CW\*(C`DBMS_APPLICATION_INFO\*(C'\fR \s-1PL/SQL\s0package. This can be used to identify the application to the \s-1DBA\s0 formonitoring and performance tuning purposes. For example:.Sp.Vb 1\&  DBI\->connect($dsn, $user, $passwd, { ora_module_name => $0 });.Ve.IP "ora_dbh_share" 4.IX Item "ora_dbh_share"Needs at least Perl 5.8.0 compiled with ithreads. Allows to share databaseconnections between threads. The first connect will make the connection, all following calls to connect with the same ora_dbh_share attributewill use the same database connection. The value must be a referenceto a already shared scalar which is initialized to an empty string..Sp.Vb 1\&  our $orashr : shared = \*(Aq\*(Aq ;\&\&  $dbh = DBI\->connect ($dsn, $user, $passwd, {ora_dbh_share => \e$orashr}) ;.Ve.IP "ora_use_proc_connection" 4.IX Item "ora_use_proc_connection"This attribute allows to create a \s-1DBI\s0 handle for an existing \s-1SQLLIB\s0database connection. This can be used to share database connectionsbetween Oracle ProC code and \s-1DBI\s0 running in an embedded Perl interpreter.The \s-1SQLLIB\s0 connection id is appended after the \*(L"dbi:Oracle:\*(R" initialargument to DBI::connect..SpFor example, if in ProC a connection is made like.Sp.Vb 1\&    EXEC SQL CONNECT \*(Aquser/pass@db\*(Aq AT \*(AqCONID\*(Aq;.Ve.Spthe connection may be used from \s-1DBI\s0 after running something like.Sp.Vb 2\&    my $dbh = DBI\->connect("dbi:Oracle:CONID", "", "",\&                           { ora_use_proc_connection => 1 });.Ve.SpTo disconnect, first call \f(CW$dbh\fR\->\fIdisconnect()\fR, then disconnect in ProC..SpThis attribute requires DBD::Oracle to be built with the \-ProCoption to Makefile.PL.  It is not available with \s-1OCI_V7\s0. Not testedwith Perl ithreads or with the ora_dbh_share connect attribute..IP "ora_envhp" 4.IX Item "ora_envhp"The first time a connection is made a new \s-1OCI\s0 'environment' iscreated by DBD::Oracle and stored in the driver handle.Subsequent connects reuse (share) that same \s-1OCI\s0 environmentby default..SpThe ora_envhp attribute can be used to disable the reuse of the \s-1OCI\s0environment from a previous connect. If the value is \f(CW0\fR thena new \s-1OCI\s0 environment is allocated and used for this connection..SpThe \s-1OCI\s0 environment is what holds information about the client sidecontext, such as the local \s-1NLS\s0 environment. So by altering \f(CW%ENV\fR andsetting ora_envhp to 0 you can create connections with different\&\s-1NLS\s0 settings. This is most useful for testing..IP "ora_charset, ora_ncharset" 4.IX Item "ora_charset, ora_ncharset"For oracle versions >= 9.2 you can specify the client charset andncharset with the ora_charset and ora_ncharset attributes.  Youstill need to pass \f(CW\*(C`ora_envhp = 0\*(C'\fR for all but the first connect..SpThese attributes override the settings from environment variables..Sp.Vb 2\&  $dbh = DBI\->connect ($dsn, $user, $passwd,\&                       {ora_charset => \*(AqAL32UTF8\*(Aq});.Ve.Sh "Database Handle Attributes".IX Subsection "Database Handle Attributes".ie n .IP """ora_ph_type""" 4.el .IP "\f(CWora_ph_type\fR" 4.IX Item "ora_ph_type"The default placeholder data type for the database session.The \f(CW\*(C`TYPE\*(C'\fR or \*(L"ora_type\*(R" attributes to \*(L"bind_param\*(R" in \s-1DBI\s0 and\&\*(L"bind_param_inout\*(R" in \s-1DBI\s0 override the data type for individual placeholders.The most frequent reason for using this attribute is to permit trailing spacesin values passed by placeholders..SpConstants for the values allowed for this attribute can be imported using.Sp.Vb 1\&  use DBD::Oracle qw(:ora_types);.Ve.SpOnly the following values are permitted for this attribute..RS 4.IP "\s-1ORA_VARCHAR2\s0" 4.IX Item "ORA_VARCHAR2"Oracle clients using \s-1OCI\s0 8 will strip trailing spaces and allow embedded \e0 bytes.Oracle clients using \s-1OCI\s0 9.2 do not strip trailing spaces and allow embedded \e0 bytes.This is the normal default placeholder type..IP "\s-1ORA_STRING\s0" 4.IX Item "ORA_STRING"Don't strip trailing spaces and end the string at the first \e0..IP "\s-1ORA_CHAR\s0" 4.IX Item "ORA_CHAR"Don't strip trailing spaces and allow embedded \e0.Force 'blank\-padded comparison semantics'..SpFor example:.Sp.Vb 1\&  use DBD::Oracle qw(:ora_types);\&  \&  $sql="select username from all_users where username = ?";\&  #username is a char(8)\&   \&  $sth=$dbh\->prepare($sql)";\&   \&  $sth\->bind_param(1,\*(Aqbloggs\*(Aq,{ ora_type => ORA_CHAR});.Ve.SpWill pad bloggs out to 8 chracters and return the username..RE.RS 4.RE.IP "ora_parse_error_offset" 4.IX Item "ora_parse_error_offset"If the previous error was from a failed \f(CW\*(C`prepare\*(C'\fR due to a syntax error,this attribute gives the offset into the \f(CW\*(C`Statement\*(C'\fR attribute where theerror was found..IP "ora_array_chunk_size" 4.IX Item "ora_array_chunk_size"Because of \s-1OCI\s0 limitations, DBD::Oracle needs to buffer up rows ofbind values in its \f(CW\*(C`execute_for_fetch\*(C'\fR implementation. This attributesets the number of rows to buffer at a time (default value is 1000)..SpThe \f(CW\*(C`execute_for_fetch\*(C'\fR function will collect (at most) this manyrows in an array, send them of to the \s-1DB\s0 for execution, then go backto collect the next chunk of rows and so on. This attribute can beused to limit or extend the number of rows processed at a time..SpNote that this attribute also applies to \f(CW\*(C`execute_array\*(C'\fR, since thatmethod is implemented using \f(CW\*(C`execute_for_fetch\*(C'\fR..Sh "Prepare Attributes".IX Subsection "Prepare Attributes"These attributes may be used in the \f(CW\*(C`\e%attr\*(C'\fR parameter of the\&\*(L"prepare\*(R" in \s-1DBI\s0 database handle method..IP "ora_placeholders" 4.IX Item "ora_placeholders"Set to false to disable processing of placeholders. Used mainly for loading a\&\s-1PL/SQL\s0 package that has been \fIwrapped\fR with Oracle's \f(CW\*(C`wrap\*(C'\fR utility..IP "ora_parse_lang" 4.IX Item "ora_parse_lang"Tells the connected database how to interpret the \s-1SQL\s0 statement.If 1 (default), the native \s-1SQL\s0 version for the database is used.Other recognized values are 0 (old V6, treated as V7 in \s-1OCI8\s0),2 (old V7), 7 (V7), and 8 (V8).All other values have the same effect as 1..IP "ora_auto_lob" 4.IX Item "ora_auto_lob"If true (the default), fetching retrieves the contents of the \s-1CLOB\s0 or\&\s-1BLOB\s0 column in most circumstances.  If false, fetching retrieves theOracle \*(L"\s-1LOB\s0 Locator\*(R" of the \s-1CLOB\s0 or \s-1BLOB\s0 value..SpSee \*(L"Handling LOBs\*(R" for more details.See also the \s-1LOB\s0 tests in 05dbi.t of Oracle::OCI for examplesof how to use \s-1LOB\s0 Locators..IP "ora_check_sql" 4.IX Item "ora_check_sql"If 1 (default), force \s-1SELECT\s0 statements to be described in \fIprepare()\fR.If 0, allow \s-1SELECT\s0 statements to defer describe until \fIexecute()\fR..SpSee \*(L"Prepare postponed till execute\*(R" for more information..Sh "Placeholder Binding Attributes".IX Subsection "Placeholder Binding Attributes"These attributes may be used in the \f(CW\*(C`\e%attr\*(C'\fR parameter of the\&\*(L"bind_param\*(R" in \s-1DBI\s0 or \*(L"bind_param_inout\*(R" in \s-1DBI\s0 statement handle methods..IP "ora_type" 4.IX Item "ora_type"Specify the placeholder's data type using an Oracle data type.A fatal error is raised if \f(CW\*(C`ora_type\*(C'\fR and the \s-1DBI\s0 \f(CW\*(C`TYPE\*(C'\fR attributeare used for the same placeholder.Some of these types are not supported by the current version ofDBD::Oracle and will cause a fatal error if used.

⌨️ 快捷键说明

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