Professional Documents
Culture Documents
initora
Ma 20, 201 0
VM
UPDATED NEWS:
://
/ /
- /
- -
/232 3
/62#
With Example
://
/ /
- /
/232 3
/46#
Faster Performance
://
/ /
- /
/232 3
/45#
:// ://
. .
. .
/ / / /
- / /
- -
- -
- /232 3 /40#
/44#
-11 - 2/232 3
:// ://
. .
. .
/ / / /
/ /
Q&A
/232 3 - - /232 3
/33# /34#
1/17/12
initora
http://knol.google.com/k/mayur-vora/learn-oracle-oem-and-all-stuffs-tricks/232y3pcqwxodx/35# Learn Oracle 10g Architecture with diagram: http://knol.google.com/k/mayur-vora/oracle-10g-architecture-with-diagram/232y3pcqwxodx/32# Learn RMAN to clone Database: http://knol.google.com/k/mayur-vora/rman-to-clone-database/232y3pcqwxodx/6# Eas wa to install Oracle 10gR2 on Linus CentOS Step b Step: http://knol.google.com/k/easy-way-to-install-oracle-database-10g-release-2-on-linux-centos-step-bystep#
New Updates: SQL Tricks tested on Oracle DB: Tuning Oracle ith hidden parameters
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/
2/14
1/17/12
initora
Connect system/manager as sysdba; select a.ksppinm b.ksppstvl b.ksppstdf decode (a.ksppity, 1, boolean , 2, string , 3, number , 4, file , a.ksppity) type, a.ksppdesc from sys.x$ksppi a, sys.x$ksppcv b where a.indx = b.indx and a.ksppinm like _% escape order by name; description name, value, default,
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/
3/14
1/17/12
initora
slc eet ades drs fo rm vsl $q wee hr sltx lk %E_UTMR; q_et ie NWCSOE 8B40 8B6C 1rwslce. o eetd
slc eet oeain prto, otos pin, ojc_ae betnm tucbts12/04 rn(ye/0412) tucls_eoyue/04 rn(atmmr_sd12) tucetmtdotmlsz/04 rn(siae_pia_ie12) tucetmtdoeassz/04 rn(siae_nps_ie12) dcd(pia_xctos nl,nl, eoeotmleeuin, ul ul otmleeuin| /|oeaseeuin| /| pia_xctos| '|nps_xctos| '| mliasseetos utpse_xcin) fo rm vslpa $q_ln wee hr padeswades+ .drs=.drs() ad n phs_au=.ahvle+ .ahvlewhs_au() ad n pi=.prto_d+ .dwoeaini() ad n pades 8B40 ; .drs= 8B6C p , vslwrae w $q_okra // O1M nu(B iptM), ls_e, atmm otmm p_e, oeasmm nps_e, nm, ae
48 52 48 52
8 57 96
TBEACS FL AL CES UL
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/
1/17/12
initora
TBEACS FL AL CES U
LNIE IETM
10 00
Finding a file on
tnsnames.ora file listener.ora file location alert log file location trace and dump file locations sqlnet.log file location(s)
l at*tcha s l .r|ed
dr*tcODmr i .r/-|oe
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/
5/14
1/17/12
initora
pop laeetrtenm o tefl t fn: rmt pes ne h ae f h ie o id acp &ieae cet flnm hs fn /-rn|rp &ieae ot id pitge I flnm
Adding C
om Me
age
o he O acle ale
log
1. 2. 3. 4. 5.
1/17/12
initora
****************************************************** select name into :alert_loc from v$parameter where name = background_dump_destination ;
****************************************************** Set the utl_file_dir (prior to Oracle9i, you must bounce the database) ******************************************************
****************************************************** Open the alert log file for write access ****************************************************** utl_file.fopen( :alert_loc , alertprod.log , W');
****************************************************** Write the custom message to the alert log file ******************************************************
dbms_output.put_line( invalid_application_error );
1/17/12
initora
utl_file.fclose( :alert_loc );
Di
ib
ing
o all Se
#/i/s !bnkh eh satn dsrbto o taae.r co trig itiuin f nnmsoa #Nt:dnmsfl i i tefr HS DTBS oe bae ie s n h om OT AAAE frhs i `a dnmsak {pit$ }` o ot n ct bae|w rn 2 d o d=ctdnmsak {pit$ }` b`a bae|w rn 1 eh co satn dsrt $ot trig it o hs rp- tsae.r $ot/t/nnmsoa c p nnmsoa hs:ectsae.r rh$otl l/t/nnmsoa s hs s a ectsae.r dn oe
doee msd ings yi1 doee po9 ings rdi doee tsm ings et1 patr reo patr reo ts9 eti tsap etps
1/17/12
initora
i eIDXid _ae NE e
e h id e e
h f e
ig
aee :
e e _ d e"=TU; g i e RE h f e ig (h id e i e
1/17/12
initora
T1 T1_IDX YES NO SQL> SELECT * FROM t1 WHERE c1 = 1; no rows selected SQL> SELECT table_name, index_name, monitoring, used FROM v$object_usage; TABLE_NAME INDEX_NAME MON USE T1 T1_IDX YES YES To reset the values in the v$object_usage view, disable index monitoring and re-enable it: ALTER INDEX indexname NOMONITORING USAGE; ALTER INDEX indexname MONITORING USAGE;
3) Run the following command: ALTER TABLESPACE tablespace-name RENAME DATAFILE OS path to old tablespacetablespace-datafile- name.dbf TO OS path to new locationtablespacedatafile-name.dbf ; 4) Take the tablespace back online
10/14
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/
1/17/12
initora
ALTER TABLESPACE tablespace-name ONLINE; If the following error is displayed ORA-01113: file n needs media recovery ORA-01110: data file n: new location file name Issue the the following command: recover datafile new location file name ; and take the tablespace back online ALTER TABLESPACE tablespace-name ONLINE;
What to do when Enterprise Manager is not able to connect to the database instance (ORA-28001) If you are trying to connect to the Oracle enterprise Manger and you get the following errors: Enterprise Manager is not able to connect to the database instance. And in t Enterprise Manager is not able to connect to the database instance. And in the Agent connection to instance section: Status: Failed Details: ORA-28001: the password has expired (DBD ERROR:
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/ 11/14
1/17/12
initora
OCISessionBegin) One of the reasons could be that the password for the SYSMAN user is expired. However, changing the password alone will not solve this issue. Several additional steps are required in order to make Oracle Enterprise Manager connect: Before you start: Verify that ORACLE_HOME, ORACLE_SID environment variables are set. If not, set them using as environment variables or open a command line and type SET ORACLE_SID=<The database SID> 1. Stop the dbconsole: emctl stop dbconsole (dos and Unix) or using the windows services stop the OrcleDBConsole<The database SID>. 2. Connect to the database as a user with DBA privilege with SQL*Plus and run the following command: alter user s sman identified b <the new password> ; 3. Verify that the new password works SQL> connect s sman/<the new password> 4. Go to ORACLE_HOME/<HostName_SID>/sysman/config and save a backup of the emoms.properties file. a) Open the file emoms.properties and search for: oracle.s sman.eml.mntr.emdRepPwd=<some encrypted value> Replace the encrypted value with the new password value b) Search for oracle.s sman.eml.mntr.emdRepPwdEncr pted=TRUE and change TRUE to FALSE c) Save and close emoms.properties 5. Restart the dbconsole: emctl start dbconsole (dos and Unix) or using the windows services start the OrcleDBConsole<The database SID>. 6. Open emoms.properties again and Search for:
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/ 12/14
1/17/12
initora
a)oracle.s sman.eml.mntr.emdRepPwd= verify that the password is encrypted b) oracle.s sman.eml.mntr.emdRepPwdEncr pted= verify that the value is set to TRUE 7. Refresh Oracle Enterprise Manager
-
by Database
2. Copy all of the tablespace datafiles to the standby datafile directory Note: This may take a long time depending on datafile size and network traffic OS>COPY <drive>:OracleORADATA<sid>*.dbf <drive>:OracleORADATASTANDBY*.* OS>COPY *.arc <drive>:OracleORADATASTANDBYArchive*.* 3. Ensure the following INIT.ORA parameters are set on the primary DB: LOG_ARCHIVE_DEST = <drive>:OracleORADATA<sid>Archive LOG_ARCHIVE_FORMAT = LOG%s%t.ARC LOG_ARCHIVE_START = TRUE 4. StartUp the primary DB with archive logging turned on SVRMGRL>connect internal SVRMGRL>startup mount <sid>; SVRMGRL>alter database archivelog;
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/ 13/14
1/17/12
initora
SVRMGRL>archive log start; SVRMGRL>alter database open; . create a standby control file SVRMGRL>alter database create standby controlfile as <drive>:OracleORADATASTANDBYstandbycf.ctl ; MOVE standbycf.ctl control01.ctl COPY control01.ctl control02.ctl COPY control01.ctl control03.ctl . Update and/or Create TNSNAMES.ora and LISTENER.ora files to include standby db . Copy the OracleAdmin<sid> directory to the corresponding standby db directory . Modify the init.ora file as follows: DB_NAME must remain the same as the primary database s entry STANDBY_ARCHIVE_DEST = <drive>:OracleORADATASTANDBYArchive LOG_ARCHIVE_DEST = <drive>:OracleORADATASTANDBYArchive LOCK_NAME_SPACE = STANDBY DB_FILE_NAME_CONVERT = ( <drive>:OracleORADATA<sid> ,'<drive>:OracleORADATASTANDBY ) LOG_FILE_NAME_CONVERT = ( <drive>:OracleORADATA<sid>Archive ,'<drive>:OracleORADATASTANDBYArchive ) . Use ORADIM to create StandBy Oracle DB service . Copy the password file PWD<sid>.ora to PWDSTANDBY.ora . SVRMGRL>Connect sys/change_on_install@standby . SVRMGRL>STARTUP NOMOUNT pfile=OracleSTANDBYAdminPFileinit.ora; . SVRMGRL>ALTER DATABASE MOUNT STANDBY DATABASE; . SVRMGRL>ALTER DATABASE RENAME FILE old_name TO new_name ; . Copy over any archive log files . SVRMGRL>RECOVER STANDBY DATABASE; . SVRMGRL> <Ret> | FILENAME | AUTO | CANCEL
Like hi : Like Be he fi o like hi a icle.
initora.wordpress.com/article/oracle-sql-tricks-232y3pcqwxodx-2/
14/14