如何安装/升级Opatch
1.My Oracle Support (MOS), Link:http://support.oracle.com2. Patches & Updates页签下,Patch Name or Number输入6880880 , 并且选择正确的平台根据你的的Release版本来下载Opatch把旧的$ORACLE_HOME/Opatch目录备份,然后把刚下载的文件拷贝到对应的ORACLE_HOME下,并解压。Example:$ cd $ORACLE_HOME (If an OPatch directory already exist then move it) $ mv Opatch /TEST/OPatch_100057 $cd $ORACLE_HOME $ unzip p6880880_101000_LINUX64.zip Archive: p6880
OPatch cannot find a valid oraInst.loc file to locate Central Inventory
命令:opatch lsinventory用于查看数据库所打Patch的列表。但运行的时候发现错误:[oracle@bej301441 OPatch]$ opatch lsinventory Invoking OPatch 11.1.0.6.2 Oracle Interim Patch Installer version 11.1.0.6.2 Copyright (c) 2007, Oracle Corporation. All rights reserved. Oracle Home : /u01/oracle/mc3yd213/db/tech_st/11.1.0 Central Inventory : n/a from : OPatch version : 11.1.0.6.2 OUI version : 11.1.0.7.0 OUI location : /u01/oracle/mc3yd213
Sequence in Oracle DB
A sequence is a database object that generates unique numbers, mostly used for primary key values. One can select the NEXTVAL and CURRVAL from a sequence. Selecting the NEXTVAL will automatically increment the sequence.Create a sequenceCREATE SEQUENCE INV.MTL_MATERIAL_TRANSACTIONS_S START WITH 22611295 MAXVALUE 4294967295 MINVALUE 1 NOCYCLE CACHE 1000 NOORDER;Selecting from the sequence:SQL> select MTL_MATERIAL_TRANSACTIONS_S.nextval from dual; NEXTVAL ---------- 24177354
Database Components Information Table - DBA_REGISTRY
DBA_REGISTRY displays information about the components loaded into the database.SELECT COMP_ID,COMP_NAME,VERSION,STATUS FROM DBA_REGISTRYORDER BY COMP_NAME;COMP_IDCOMP_NAMEVERSIONSTATUSJAVAVMJServer JAVA Virtual Machine11.2.0.1.0VALIDAPSOLAP Analytic Workspace11.2.0.1.0VALIDAMDOLAP Catalog11.2.0.1.0VALIDOWBOWB11.2.0.1.0VALIDAPEXOracle Application Express3.2.1.00.10VALIDOCAOracle Application Server Certificate Authority10.1.2.0.2VALIDDCMOracle Application Server Distributed Configuration Manage
ORA-01031: insufficient privileges
command \'sqlplus system/manager\' works fine. But in case connect system/manager as sysdba, it will tell me "ORA-01031: insufficient privileges" error.[oracle@bej301441 ~]$ sqlplus system/manager as sysdbaSQL*Plus: Release 10.1.0.5.0 - Production on Wed Mar 6 08:13:11 2013Copyright (c) 1982, 2005, Oracle. All rights reserved.ERROR:ORA-01031: insufficient privilegesSolutionThis is not the sqlplus which under $RDBMS_ORACLE_HOME.We need switch ORACLE_HOME to real DB HOME,and use
Script – Database structure and file location
1.Control Filesset pagesize 500 set linesize 130 Prompt Prompt Control Files Location >>>> col name format a60 heading "Control Files" select name from sys.v_$controlfile /2.Redo Log FilesPrompt Prompt Redo Log File Locations >>>> Prompt col Grp format 9999 col member format a50 heading "Online REDO Logs" col File# format 9999 col name format a50 heading "Online REDO Logs" break on Grp select group#,member from sys.v_$logfile /
Oracle Server Architecture Diagram(10g,11g)
10g(R2) (大图 )11g (大图)
DBA_SEGMENTS - 查看数据库对象所分配的物理存储空间
如何查看某个数据库对象(TABLE, INDEX ....)所占得物理存储空间SELECT SEGMENT_NAME,SEGMENT_TYPE,TABLESPACE_NAME,EXTENTS,BLOCKS,BYTES/1024/1024/1024 GB FROM DBA_SEGMENTS WHERE SEGMENT_NAME = Upper(\'MTL_MATERIAL_TRANSACTIONS\'); Oracle逻辑结构全景结构图 Oracle 逻辑结构的相关数据字典:SELECT * FROM DBA_TABLESPACES -- 记录各个表空间的详细信息 SELECT * FROM DBA_TABLESPACE_USAGE_METRICS -- 记录各个表空间的使用状况 SELECT * FRO
Output format of a 10046 sql trace file
The header/appl/oracle/admin/EI1T/udump/ei1t_ora_14246.trc Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production JServer Release 9.2.0.3.0 - Production ORACLE_HOME = /appl/oracle/product/9.2.0 System name: SunOS Node name: sdsunn01 Release: 5.9 Version: Generic_112233-08 Machine: sun4u Instance name: EI1T Redo thread mounted by this instance: 1 Oracle process number: 17 Unix process pid: 14246, image: oracle@sdsunn01?(TNS V1-V3) *** 2003-10-13 16:13:59.
使用DBMS_UTILITY.GET_TIME来捕获某段代码的执行时间
DBMS_UTILITY.GET_TIME常用于计算某段代码间的时间消耗,DBMS_UTILITY.GET_TIME返回值本身并不是指当前的时间,而是一个the number of 100ths of seconds that have elapsed from an arbitrary time.Usage NotesYou should not use GET_TIME to establish the current time, but only to calculate the elapsed time between two events. Without GET_TIME, Oracle functions can only record and provide elapsed time in second intervals, which is a very coarse granularity in today\'s world
optimizer_features_enable
if you upgrade your database from release 10.1 to release 11.1, but you want to keep the release 10.2.0.4 optimizer behavior, you can do so by setting this parameter to 10.2.0.4. At a later time, you can try the enhancements introduced in releases up to and including release 11.1 by setting the parameter to 11.1.0.6.ALTERSYSTEM SET optimizer_features_enable = \'10.2.0.4\';PropertyDescriptionParameter typeStringSyntaxOPTIMIZER_FEATURES_ENABLE = { 8.0.0 | 8.0.3 | 8.0.4 | 8.0.5 | 8.0.6 | 8.0.7 |
Oracle数据库的历史
Here is the list of important events that took place in the last 30 years of Oracle history. Oracle is celebrating its 30 wonderful years in the industry (from 1977 to 2007). This article was updated on 6th August, 2007.In 1977, Larry Ellison, Bob Miner and Ed Oates founded Software Development Laboratories to undertake development workAfter reading a paper by Codd in IBM Journal of Research and Development, they created Oracle. The first version was never released. It was written in Assembly
ODBC连Oracle数据库报错,SQLState=IM004
Window7下使用ODBC连Oracle数据库(11g的),然后报下边的错误:Unable to connectSQLState=IM004[Microsoft][ODBC 驱动程序管理器]驱动程序的 SQLAllocHandle on SQL_HANDLE_ENV 失败解决方法:原来是Oracle_Home指向错了,我连得是Oracle11g的数据库,但环境变量里指定的Oracle_Home为一个Oracle10g的路径,所以连得时候,ODBC报驱动错误.
OS & Oracle is 32-bit or 64-bit?
如何判断Oracle数据库是32位还是64位?Script 1:SELECT length(addr)*4 || \'-bits\' word_length FROM v$process where ROWNUM =1;Script 2:select * from v$version;output like:Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for Linux: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production如何判断Linux操作系统是32位还是64位?[oracle@bej301441 bin]$ uname -m x86_6
Script to compile invalid objects in DB
REM: Script to compile invalid objects in DB after refreshing REM: REM:***************************************** REM: REM: NOTE: PLEASE TEST THIS SCRIPT BEFORE USE. REM: Author will not be responsible for any damage that may be cause by this script. REM:***************************************** set pagesize 0 set feedback off set trimspool on prompt prompt Run the script as sysdba otherwise invalid objects will remain (ORA-01031 error) prompt prompt Run the script several times. It only takes
SQL*Plus commands
The following commands can be issued in SQL*Plus (in addition to the standardSQL commands.) @pathname Run (START) an SQL Script @MyScript.sql parameter1 parameter2 parameter3 In the SQL-Script, refer to the parameters as &1, &2, and &3. @ScriptName.sql will call sub-scripts from the current working directory of SQL*Plus. @C:\work\oracle\ScriptName.sql will call a sub-script from a specific directory. @@pathnam
.trc and .trm files in Oracle 11g
What is .trc file? Ans:Sql Trace Collection file What is .trm file? Ans:Trace map (.trm) file.Trace files(.trc) are sometimes accompanied by corresponding trace map (.trm) files, which contain structural information about trace files and are used for searching and navigation. Doc ID 750982.1 explains this very well ------ (Doc ID 750982.1):TRM Trace Files Getting Generated in 11g Database From 11g onwards, all the trace files are found in ADR_HOME/trace directory. There is usual
让Sql Plus环境变量的设置永久生效
每次打开Sql Plus都要设置环境变量,很麻烦,这里有个方法可以永久的保存你的环境变量的设置。 设置$ORACLE_HOME/sqlplus/admin/glogin.sql文件,在后边加上你自己的个性化设置。这样每次启动Sqlplus(不管是官方的sqlplus客户端,还是cmd命令行启动的sqlplus),都会读取glogin.sql的设置。 下边是我glogin.sql里的设置: ------------------------------------------- prompt Loading PTIAN glogin.sql file... --提示
ASCII & CHR Function
The ASCII function returns the NUMBER code that represents the specified character.ASCII( single_character ) SELECT ASCII(\'A\') FROM dual; Output:A The CHR function is the opposite of the ascii function. It returns the character based on the NUMBER code. CHR( number_code ) SELECT CHR(9) FROM dual; Output:TAB 记录这个的原因是因为,遇到一客户问题,发现系统里的lot number中有空格似的字符,但是使用下边的query,又查不出
Prompt & Accept in sqlplus
With prompt & accept, it is possible to interactively set a value for a user variable in SQL*Plus. Sample 1 set echo off; set serveroutput on size 999999; Prompt ptian test script prompt Please enter employee number?:; accept p_emp_no; declare val varchar2(30); begin select ENAME into val from emp where EMPNO = &p_emp_no and rownum = 1; dbms_output.put_line(\'Employee is \' || val); exception when others then dbms_output.put_line(\'Encounter a error,ORA ERR