Website Technology Profiler
Discover What Any Website Is Built With – Instantly
Identify the technologies behind any website with one simple click you can quickly see what frameworks, platforms, plugins, analytics tools, and hosting providers a site uses.
Our site works as a powerful website technology profiler, scanning the page and generating a full breakdown of all detectable technologies. From CMS platforms and eCommerce systems to JavaScript libraries and server software helping you understand exactly how a website is built.
Perfect for developers, marketers, SEO professionals, and anyone curious about the tech stack behind their favorite websites.
Executive Summary for manoj-dba.blogspot.com
SEO & Content Analysis
Basic Information
SEO Meta Tags
content-type: text/html; charset=UTF-8
Page Content
ORACLE DBA
ORA-16047: DGID mismatch between destination setting and target sol:check the service name in log_archive_dest_2 and check fal and defer and enable the dest state********************************************************************************./runInstaller -ignorePrereq -J"-Doracle.install.db.validate.supportedOSCheck=false" -ignorePrereq "-ignoreInternalDriverError"***********************************************************************************************************************************PMON failed to acquire latch, see PMON dump sol:kill smon and start the instance or sqlplus -prelim / as sysdba shut abort then startORA-07445: Message 7445 not found; No message file for product=RDBMS, facility=ORA; *********************************************************************************************ORA-29701: unable to connect to Cluster Synchronization Service RESOLVABLE GAP**************************************************************Failed to open service <OracleOraDb11g_home2TNSListenerLISTENER1*********************************************************RMAN> sql 'alter database open resetlogs';sql statement: alter database open resetlogsRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: ===========================================================RMAN-03009: failure of sql command on default channel at 09/07/2017 13:41:14RMAN-11003: failure during parse/execution of SQL statement: alter database open resetlogsORA-00349: failure obtaining block size for '+REDO/etlprod/redo01.losol: ALTER DATABASE RENAME FILE '+REDO/etlprod/redo03.log' to '/home/oracle/app/oracle/oradata/ETLPROD/redo03.log';***********************************************************************************************************************************SQL> alter database open resetlogs;alter database open resetlogs*ERROR at line 1:ORA-00392: log 1 of thread 1 is being cleared, operation not allowedORA-00312: online log 1 thread 1: ------sol: alter database clear logfile group 1;'/home/oracle/app/oracle/oradata/ETLPROD/redo01.log'ORA-00312: online log 1 thread 1:'/home/oracle/app/oracle/oradata/ETLPROD/redo01a.log'***********************************************************************************************************************************RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== check the file permissionRMAN-00571: ===========================================================RMAN-03002: failure of restore command at 01/05/2016 10:37:31RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece***********************************************************************************************************************************ORA-12547: TNS:lost contact ---https://oracledbamasters.wordpress.com/2014/02/25/ora-12547-tns-lost-contact/ -- check the permission on birnaries***********************************************************************************************************************************ERROR at line 1:ORA-00376: file 4 cannot be read at this time --tablespace or datafile might be offline --make it as onlineORA-01110: data file 4: '/home/oracle/app/oracle/oradata/DB01/users01.dbf'***********************************************************************************************************************************ORA-01157: cannot identify/lock data file 201 - see DBWR trace file ---setup.exe -ignorePrereq -ignorePrereq -J"-Doracle.install.db.validate.supportedOSCheck=false --windowschmod +R 777 CVU_11.2.0.4.0_oracle in /tmp/ -- Linuxora-2048 9i client trying to connect -- 11g database ***********************************************************************************************************************************@casesensitive sec_case_sensitive_logon=true default passwork case sensitive***********************************************************************************************************************************Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsExport done in US7ASCII character set and AL16UTF16 NCHAR character set windows db sever --> linux client exporterver uses AL32UTF8 character set (possible charset conversion)***********************************************************************************************************************************ORA-19502: write error on file "/backup/RMAN_BKP/25Apr17230001/smsdb_rmanbkp_u48s2kcu5_s38024_p1_t20170426", block number 1418113 (block size=8192)ORA-27061: waiting for async I/Os failedLinux-x86_64 Error: 5: Input/output error reason:Filesystem error***********************************************************************************************************************************https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=429723768106311&id=1630653.1&displayIndex=1&_afrWindowMode=0&_adf.ctrl-state=7jctwvisz_114#SYMPTOMpostupg:The Database has been upgraded from 11.2.0.2 to 11.2.0.4. Upgrade completed successfully but the OWB component is not upgraded and showing version 11.2.0.4Solution:Login as sysdba and execute below scripts execute the script $ORACLE_HOME\owb\UnifiedRepos\clean_owbsys.sqlexecute the script $ORACLE_HOME\owb\UnifiedRepos\cat_owb.sql***********************************************************************************************************************************SQL> alter database open;alter database open*ERROR at line 1: --> create textcontrolfileORA-01190: control file or data file 1 is from before the last RESETLOGSORA-01110: data file 1: '+DATA/t1/datafile/system_01.dbf'***********************************************************************************************************************************ERROR at line 1:ORA-38784: Cannot create restore point 'SNAPSHOT_STANDBY_REQUIRED_11/13/200911:18:18'.ORA-38786: Flash recovery area is not enabled.To enable the Flash Recovery areaQL> alter system set db_recovery_file_dest_size = 2G;System altered.SQL> alter system set db_recovery_file_dest='/u01/Stage11g/flash_recovery_area/STANDBY11g';System altered.***********************************************************************************************************************************RMAN-06094: datafile 1 must be restoredSQL> startup nomountORA-27102: out of memoryLinux-x86_64 Error: 28: No space left on deviceAdditional information: -1895825408Additional information: 1sol:increaase kernel.shmall = 4194304sysctl -phttp://padmavyuha.blogspot.in/2010/12/configuring-shmmax-and-shmall-for.html***********************************************************************************************************************************ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instanceORA-15097: cannot SHUTDOWN ASM instance with connected client (process 5476) --> shut down the database instance firsthttp://dbasoumya.blogspot.in/2015/02/alert-mail-script-for-checking-oracle.htmlhttps://communities.bmc.com/docs/DOC-9942 --shellhttp://tutorial-sql-databases.blogspot.in/2014/09/manual-upgrades-to-oracle-database-12c.html --Manual upgradationhttp://allthingsoracle.com/upgrading-a-database-using-recovery-manager-rman-duplicate-command-in-oracle-12c/ -- Manual upgradationhttp://sandeepnandhadba.blogspot.in/2014/12/oracle-golden-gate-12-bidirectional.htmlhttp://orcltechnology.blogspot.in/2016/03/upgrading-oracle-database-11204-to-12101.html --upgradationsqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory --> cd $ORACLE_HOME/bin/ -->relinkinhttp://localhost:5500/emOC4J Configuration issue. /opt/oracle/prod -->#127.0.0.2 myhost.domain.local myhost http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/241652.htm#o --emctl*ORA-01078: failure in processing system parameters --> *ORA-29701: unable to connect to Cluster Synchronization Service --> ./crsctl start resource ora.cssd (or) https://dbamind.wordpress.com/2014/01/29/ora-29701-unable-to-connect-to-cluster-synchronization-service/http://myoracleproduct.blogspot.in/2013/11/oracle-goldengate-replication-oracle-to.html --goldengateListerner purge --https://samadhandba.wordpress.com/2011/03/07/emptyremove-oracle-listener-log-files/http://allappsdba.blogspot.in/2012/04/scripts-related-to-temp-tablespace.html --temp12c--http://db12c.blogspot.in/2013/10/clone-pluggable-database-to-remote.html12c--https://yasinyazici.wordpress.com/2014/11/19/clone-pluggable-database-to-another-container-database-over-the-network/http://www.pro-oracle.com/2014/10/oracle-database-resolving-library-cache.htmlhttps://orainternals.wordpress.com/2009/06/02/library-cache-lock-and-library-cache-pin-waits/https://dbacatalog.wordpress.com/2014/10/20/ora-04021-timeout-occurred-while-waiting-to-lock-object/ORA-00059: maximum number of DB_FILES exceeded ---> alter system set db_files=150 scope=spfile;https://sachinichake.wordpress.com/2013/05/08/step-by-step-golden-gate-configuration/ORA-12162: TNS:net service name is incorrectly specified --> export ORACLE SIDORA-04021: timeout occured while to lock objectORA-12514: TNS:listener does not currently know of service requested in connect descriptor -->reason for this is that the database instance has not been startedORA-12541: TNS:no listener -->start the listenerORA-12154: TNS: could not resolve the connect identifier specified --> reson user entered the wrong connect identifierORA-01555: snapshot too old: rollback segment number --> ALTER system SET undo_retention=10800;*ORA-01194: file 1 needs more recovery to be consistent --->*ORA-01110: data file 1: ‘D:\ORACLE\PRODUCT\10.2.0\ORADATA\DBTEST\SYSTEM01.DBF’ -->recover database using backup controlfile until cancel; -->ALTER SYSTEM SET "_allow_resetlogs_corruption"= TRUE SCOPE = SPFILE; & ALTER SYSTEM SET undo_management=MANUAL SCOPE = SPFILE; & alter database datafile 7 offline drop;https://blogs.oracle.com/optimizer/entry/explain_adaptive_cursor_sharing_behavior_with_cursor_sharing_similar_and_forceORA-03135: connection lost contact ORA-01178: file 6 created before last CREATE CONTROLFILE, cannot recreateORA-01190: control file or data file 1 is from before the last RESETLOGSORA-01152: file 1 was not restored from a sufficiently old backup -->recover database using backup controlfile until cancel or recover database until cancel using backup controlfile;-->aply-->alter database open resetlogs;ORA-01034: ORACLE not availablesampletns:---------@tnsfileRDB =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.32.128)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = rdb)))###############################samplelistener:--------------SID_LIST_LISTENER =(SID_LIST =(SID_DESC =(SID_NAME = rdb)(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)))RDB =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = sample.com)(PORT = 1521))))##############################11gpfile:---------cpr.__db_cache_size=197132288cpr.__java_pool_size=4194304cpr.__large_pool_size=4194304cpr.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environmentcpr.__pga_aggregate_target=251658240cpr.__sga_target=369098752cpr.__shared_io_pool_size=0cpr.__shared_pool_size=155189248cpr.__streams_pool_size=0*.audit_file_dest='/u01/app/oracle/admin/cpr/adump'*.audit_trail='db'*.compatible='11.2.0.0.0'*.control_files='/u01/app/oracle/oradata/cpr/control01.ctl','/u01/app/oracle/fast_recovery_area/cpr/control02.ctl'*.db_block_size=8192*.db_domain=''*.db_name='cpr'*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'*.db_recovery_file_dest_size=4196401152*.diagnostic_dest='/u01/app/oracle'*.dispatchers='(PROTOCOL=TCP) (SERVICE=cprXDB)'*.memory_target=620756992*.open_cursors=300*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.undo_tablespace='UNDOTBS1'##########################################sfms.__db_cache_size=1224736768sfms.__java_pool_size=16777216sfms.__large_pool_size=16777216sfms.__oracle_base='E:\app\administrator'#ORACLE_BASE set from environmentsfms.__pga_aggregate_target=587202560sfms.__sga_target=1627389952sfms.__shared_io_pool_size=0sfms.__shared_pool_size=335544320sfms.__streams_pool_size=16777216*.audit_file_dest='E:\app\Administrator\admin\SFMS\adump'*.audit_trail='db'*.compatible='11.2.0.0.0'*.control_files='E:\app\Administrator\oradata\SFMS\control01.ctl','E:\app\Administrator\oradata\SFMS\control02.ctl','E:\app\Administrator\oradata\SFMS\control03.ctl'*.db_block_size=8192*.db_domain=''*.db_name='SFMS'*.db_recovery_file_dest='E:\app\Administrator\flash_recovery_area'*.db_recovery_file_dest_size=2147483648*.db_unique_name='SFMS_KHAR'*.diagnostic_dest='E:\app\Administrator'*.dispatchers='(PROTOCOL=TCP) (SERVICE=sfmsXDB)'*.fal_client='SFMS_KHAR'*.fal_server='SFMS_BEL'*.log_archive_config='DG_CONFIG=(SFMS_BEL,SFMS_KHAR,SFMS_NAG,SFMS_KHR)'*.log_archive_dest_1='LOCATION=G:\archives\sfms VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=SFMS_KHAR'*.log_archive_dest_2='SERVICE=SFMS_BEL LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SFMS_BEL'*.log_archive_dest_3='SERVICE=SFMS_NAG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SFMS_NAG'*.log_archive_dest_4='SERVICE=SFMS_KHR LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SFMS_KHR'*.log_archive_dest_state_1='ENABLE'*.log_archive_dest_state_2='ENABLE'*.log_archive_dest_state_3='DEFER'*.log_archive_dest_state_4='DEFER'*.log_archive_format='%s_%r.%t'*.memory_target=2204106752###############################################################10gpfile:---------*.audit_file_dest='/u01/app/oracle/product/10.2.0/db_1/admin/rdb/adump'*.background_dump_dest='/u01/app/oracle/product/10.2.0/db_1/admin/rdb/bdump'*.compatible='10.2.0.1.0'*.control_files='/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/control01.ctl','/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/control02.ctl'*.core_dump_dest='/u01/app/oracle/product/10.2.0/db_1/admin/rdb/cdump'*.db_block_size=8192*.db_domain=''*.db_file_multiblock_read_count=16*.db_name='rdb'*.db_recovery_file_dest='/u01/app/oracle/product/10.2.0/db_1/flash_recovery_area'*.db_recovery_file_dest_size=2147483648*.job_queue_processes=10*.open_cursors=300*.pga_aggregate_target=16777216*.processes=150*.remote_login_passwordfile='EXCLUSIVE'*.sga_target=167772160*.undo_management='AUTO'*.undo_tablespace='UNDOTBS1'*.user_dump_dest='/u01/app/oracle/product/10.2.0/db_1/admin/rdb/udump'#######################################################@logfilesize:-----------SET LINESIZE 200COLUMN member FORMAT A50COLUMN first_change# FORMAT 99999999999999999999COLUMN next_change# FORMAT 99999999999999999999col GROUP# for 9col THREAD# for 9SELECT l.thread#,lf.group#,lf.member,TRUNC(l.bytes/1024/1024) AS size_mb,l.status,l.archived,lf.type,lf.is_recovery_dest_file AS rdf,l.sequence#,l.first_change#,l.next_change# FROM v$logfile lfJOIN v$log l ON l.group# = lf.group#ORDER BY l.thread#,lf.group#, lf.member;##############################################################################crdb.sql:--------create database rdbdatafile '/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/system.dbf' size 400Msysaux datafile '/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/sysaux.dbf' size 400Mundo tablespace undotbs1 datafile '/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/undo.dbf' size 400Mdefault temporary tablespace temp tempfile '/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/temp.dbf' size 300Mlogfile group 1('/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/redo1.log') size 30M,group 2('/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/redo2.log') size 30M,group 3('/u01/app/oracle/product/10.2.0/db_1/oradata/rdb/redo3.log') size 30M;########################################################expimp:-------1.TRANFER THE DATA FROM ORACLE TO ORACLEDATABASE LEVEL ENTIRE TO ANTHOER DATABASESCHEMA TABLEROWX SCHEMA WANT TO DUPLICATE IN THE SAME SCHEMA SO CREATE Y EXP X AND IMPORT$ exp file=full_devdb_sysdate.dump log=full_devdb_sysdate_log.log full=yexp file=scott_prd_sysdate.dmp log=scott_prd_sysdate.log owner='SCOTT'exp file=emp_prd_sysdate.dmp log=emp_prd_sysdate.log tables='SCOTT.EMP' statistics=noneexp file=emp_dept10_sysdate.dmp log=emp_dept10_sysdate.log tables='scott.emp' query=\"where deptno=10 \" statistics=nonedesired loc file=/u02/emp_prodbuffer to speed up export porcessit should be 10*avg row levelprafile: list of commanadsnew file 1.parfileuserid='/ as sysdba'file=proddb.dmplog=prodb.logfull=ydirect=ybuffer=5000indexes=nexp parfile=1.parfileconsistent no better to make s ?=========reading updation is take placess it will take the data from undo tablespaces=================================================================IMPORT======================================================================Take the export and transfer it to another serverscp kanna.dmp oracle@192.168.1.120:/u02schemacreate new user with same name imp file=kanna.dmp log=imp_kanna.log fromuser='kanna' touser 'kanna2'tableimp file=kanna.dmp log=kanna.log fromuser='scott' touser='kanna' opt(tables='scott.emp' or tables='emp')rowsimp file=emp.dmp log=emp_kanna.log fromuser='scott' touser='kanna' tables='emp' options======show=yimp file=emp_row.dmp log=1.log show=y fromuser='scott' touser='kanna'if table is already existsignore=yimp file=emp_row.dmp log=2.log fromuser='scott', touser='kanna' ignore=yoracle skip and continue furthercommit=y=====AFTER IMPORTING COMMIT WILL ISSUED 30 DATAPUMPneed to understand the error:ORA-01102: cannot mount database in EXCLUSIVE mode***********************************export multiple table and imp multiple tables************************exp file=f1.dmp log=f1.log tables='SYS.T1','SYS.T2'imp file=f1.dmp log=f1.log fromuser='SYS' touser='PUSR'datapump:---------col owner for a20col directory_path for a60set lines 150set pages 999select * from dba_directories;@objcount:------------select owner,object_type , count(*) from dba_objects where status='INVALID' group by object_type,owner;select distinct object_type,count(*),status from dba_objects where owner='<>' group by object_type,status;sql> !mkdir /u02/dpdirsql> create directory dpdir as /u02/dpdir$expdp directory=dpdir dumpfile=1.dmp logfile=1.log full=ysysdbaSQL>grant read,wirte on directory dpdir to kannatablspace leve posibleselect * from dba_datapump_jobs;expdp help=yattach: expdp directory=dpdir dumpfile=1.dmp logfile=1.log full=yexpdp attach=sys_export_full_01 / as sysdabcontl+cexport> exitexpdp attach='jobname'export>statuscompression:======content data and metadata======estimate: calate and perform exp========estimate only only calculate ============exclude: shema having 100 tables u dont want to exp so u can use even view etc=====parlel: 10 process will take care of u r exp======version:=======9i exp imp on 10g lower to highernormal exp imp not possible the aboveexp 11g imp into 10gaddfile:======we can add anthoer dumpfilecontinue=======kill_job========expdp: u can pauase the job continue laternetworklink:------------- Create user on SOURCE db to use for network link in TARGET database.CREATE USER ARTISDBA IDENTIFIED BY "Password123$";GRANT DBA TO ARTISDBA;- Create Database link on targetCREATE DATABASE LINK SERVICE_NAME CONNECT TO ARTISDBA IDENTIFIED BY "Password123$" USING 'SERVICE_NAME';- Copy TNSNAMES entry for source database to target's tnsnames.ora file.- Create directory in TARGET to use for your logfiles.CREATE DIRECTORY dumpdir AS '/orabkup/expdp';GRANT READ,WRITE ON DIRECTORY dumpdir to PUBLIC;- Run import job on TARGET. You parallelize the job to make it faster.impdp parfile=impdp.parPARFILE contents:DIRECTORY=dumpdirNETWORK_LINK=SERVICE_NAMESCHEMAS='TEST'PARALLEL=4LOGFILE=impdp_from_service_name.logTABLE_EXISTS_ACTION = {SKIP | APPEND | TRUNCATE | REPLACE}As the name implies, table_exists_action is used in impdp when the table already exists in the database where the import is being executed.table_exists_action=skip: This says to ignore the data in the import file and leave the existing table untouched. This is the default and it is not a valid argument if you set content=data_only.table_exists_action=append: This says to append the export data onto the existing table, leaving the existing rows and adding the new rows from the dmp file. Of course, the number and types of the data columns must match to use the append option. Just like the append hint, Oracle will not re-user any space on the freelists and the high-water mark for the table will be raised to accommodate the incoming rows.table_exists_action=truncate: This says to truncate the existing table rows, leaving the table definition and replacing the rows from the expdp dmp file being imported. To use this option you must not have any referential integrity (constraints) on the target table. You use the table_exists_action=truncate when the existing table columns match the import table columns. The truncate option cannot be used over a db link or with a cluster table.table_exists_action=replace: This says to delete the whole table and replace both the table definition and rows from the import dmp file. To use this option you must not have any referential integrity (constraints) on the target table. You use the table_exists_action=replace when the existing table columns do not match the import table columns.expdp directory=EXP_IMP_DIR dumpfile=expdp_BR_%u.dmp logfile=expdp_BR.log tables=SFMSBR.MTB_MSG_TXT_BR filesize=2G parallel=4expdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_%u.dmp logfile=expdp_FULL.log filesize=2G parallel=4 FULL=Yexpdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_%u.dmp logfile=expdp_FULL_1.log filesize=10G parallel=4 FULL=Yexpdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_%u.dmp logfile=expdp_FULL_1.log filesize=10G FULL=Yhttp://artisdba.blogspot.in/2011/04/data-pump-impdp-via-network-link.htmlexpmultipledir:---------------CREATE OR REPLACE DIRECTORY TEST_DIR1 AS '/software_dump/11gR204/dbbackup/mpesa_platform_bkp/test1';CREATE OR REPLACE DIRECTORY TEST_DIR2 AS '/software_dump/11gR204/dbbackup/mpesa_platform_bkp/test2';expdp SCHEMAS=MPESA_PLATFORM DUMPFILE=TEST_DIR1:MPESA_PLATFORM_1%u.dmp,TEST_DIR2:MPESA_PLATFORM_2%u.dmp FILESIZE=100M LOGFILE=TEST_DIR1:expdp_log JOB_NAME=expdp_Mpesa parallel=2 http://www.linkedin.com/groups/Multiple-EXPDP-Directories-77941.S.5849421326418194436@expcheck----------select sid, serial#, sofar, totalwork,(sofar/totalwork) * 100 done, dp.owner_name, dp.state, dp.job_mode from gv$session_longops sl, gv$datapump_job dp where sl.opname = dp.job_name and sofar != totalwork; ##################################################################################@catalog:--------RECOVERY CATALOGIs is a separte database in which u r going maintain rman backup information this info will store in control file. backup info of multiple db will store and if u lost control file of target db it will help to recover dbBackup information of multiple database will storeback color is target white is recovery catlog db1.create tablespace rmantbs datafile '/u01/ora10g/rcatdb/rmantbs01.dbf' size 100m2.create user rman_rc identified by rman_rc default tablespace rmantbs temporary tablespace temp;3.Grant connect,resource,recovery_catalog_owner to rman_rc4.$ rman catalog rman_rc/rman_rc5.create catalog; =====>once u issue tables view will be created we can see those after connecting to rman_rc user. back up info store in these tables6.conn rman_rc/rman_rc===========to target database block colorcd oracle_home/network/admin/tnsname.oraservice_name =listername(rcatdb)tnsping rcatdb 10:misconfigure the tns names.orarman target /catlog rman_rc/rman_rc@rcatdbRMAN>register database (this info will store in rcatdb)waytotakebkp:------------rman target /catlog rman_rc/rman_rc@rcatdbRMAN> backup database plus archive;========From catdb side to we can connect to target db===========rman target sys/oracle@ROD catalog pusr/pusr@ODRMAN>BACKUP DATABASE PLUS ARCHIVELOG;#########################################################################################RMAN CLOING:COLOING IS PROCESS OR REPLICATING EXISTS DATABASE IN ANOTHER SERVERS dp or exp imp smaller database if u r db is 10 tb or 20 tb in case we need to go rman cloningrefreshing vs cloningsome set of scheman or tables copying entire db it is cloningNOTE:The server os vesion the databse version should be same aix 64 aix 6410g 10g1 db white(prod)2.test black (test)test block (prod) 8==================#install 11 gwhite:=====1.create pfile from spfile$ scp initprod.ora oracle@192.1.23.34: /u01/oacle_home/dbs/inittestdb.ora black: change the name in in pfile in testdbadd 2 perameters1.db_file_name_convert 2.log_file_name_convertlog_archive_dest crated directry alsocreate nessary directorieson the production server where redo,data exsits /u01/oradata/prod /u01/oradata/testorapwd file=orapwprodb password=sys123 force=y$scp orapwprodb oracl@192.1.23.34: /u01/oacle_home/dbs/orapwtestdb both side configure lister and tnsnames creating lister and tns invoke vnc create listnertns : testdbtns :prodbvnc invoke$ps -ef | grep tnsif listner not up and running start listnerlsnctl stop listnervi listnersid =proddbtnsping prodb tnsping prodbtnsping tesdb tnsping testdbshut immediatestartup mountrman target /RMAN> backup database plus archivelog; store backup peices in some location create same direcories same location 40TAKE FULL RMAN BACKUPPieces handled /u01/jdld/ mkdir -p /u01/jdld/scp *.bkp oracle@192.168.120 test side invoke rman export oracle_sid=testdbsqlplus / as sysdbaSQL>STARTUP NOMOUNT rman target sys/sys@123@test auxiliary sys/sys123@testdb RMAN>duplicate target database to testdb nofilenamecheckV$BACKUP_SETRC_BACKUP_SET#############################################################################################################CREATE TABLESPACE:=================create tablespace mytbsdatafile '/u02/ora10g/prod/mytbs01.dbf' size 50mautoextend on maxsize 200mextent management local / dictionarysegment space management auto / manualinittrans 1 maxtrans 255pctfree 20 pctused 40initial 1m next 5mpctincrease / uniform / autoallocateminextents 1 maxextents 500logging / nologgingblocksize 8k; - this is optionalCHECK TABLESPACE INFO:=====================select allocation_type,extent_management,contents from dba_tablespaces where tablespace_name='MYDATA';@freedata:---------col file_name for a50select file_name,sum(bytes)/1024/1024 "ACTU",autoextensible,sum(maxbytes)/1024/1024 "MAX" from dba_data_files where tablespace_name='&tbs' group by file_name,autoextensible order by 1;DATABASE SIZE:=============1 - The size of the Oracle database files can be computed several ways:-- get database size from v$datafile:select round((sum(bytes)/1048576/1024),2) from v$datafile;-- get Oracle database size from dba_data_files:select"Reserved_Space(MB)", "Reserved_Space(MB)" - "Free_Space(MB)" "Used_Space(MB)","Free_Space(MB)"from(select (select sum(bytes/(1014*1024)) from dba_data_files) "Reserved_Space(MB)",(select sum(bytes/(1024*1024)) from dba_free_space) "Free_Space(MB)"from dual);TABLE_SIZE:===========2 - The size of the sum of table extentsselect segment_name table_name, sum(bytes)/(1024*1024) table_size_meg from user_extents where segment_type='TABLE' and segment_name = 'MYTAB' =====================select sum(bytes/1024/1024/1024) from dba_data_files;ENABLE/DISABLE AUTOEXTEND:=========================alter database datafile ‘/u02/prod/mytbs01.dbf’ autoextend on maxsize 100m;alter database datafile ‘/u02/prod/mytbs01.dbf’ autoextend off;RESIZE DATAFILE:===============alter database datafile ‘/u02/prod/mytbs01.dbf’ resize 20m;ADD DATAFILE:============alter tablespace mytbs add datafile ‘/u02/prod/mytbs02.dbf’ size 10m;RENAME TABLESPACE:=================alter tablespace mytbs rename to mydata;========FREECOLUMN pct_free FORMAT 999.99 HEADING "% Free" COLUMN name FORMAT A16 HEADING "Tablespace Name" COLUMN mbytes FORMAT 99,999,999 HEADING "Total MBytes" COLUMN used FORMAT 99,999,999 HEADING "Used Mbytes" COLUMN free FORMAT 99,999,999 HEADING "Free Mbytes" BREAK ON REPORTCOMPUTE SUM OF mbytes ON REPORT COMPUTE SUM OF free ON REPORT COMPUTE SUM OF used ON REPORT SELECT fs.tablespace_name name, df.totalspace mbytes, (df.totalspace - fs.freespace) used, fs.freespace free, 100 * (fs.freespace / df.totalspace) pct_free FROM (SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) TotalSpace FROM dba_data_files GROUP BY tablespace_name ) df,(SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) FreeSpace FROM dba_free_space GROUP BY tablespace_name ) fsWHERE df.tablespace_name = fs.tablespace_name(+);==========.201SQL> select file_name,sum(bytes)/1024/1024/1024,sum(maxbytes)/1024/1024/1024 from dba_data_files group by tablespace_name,file_name having tablespace_name='NEFT_ARCH_NDX';========================chktbs:-------col "NAME" format a30set lines 140set pages 1000select a.tablespace_name "NAME",(b.totalspace - a.freespace)"USED SPACE",a.freespace "FREE SPACE",b.totalspace "TOTAL SPACE",round(100 * (a.freespace / b.totalspace)) "% FREE"from(select tablespace_name,sum(bytes)/1024/1024 TotalSpacefrom dba_data_filesgroup by tablespace_name) b,(select tablespace_name,sum(bytes)/1024/1024 FreeSpacefrom dba_free_spacegroup by tablespace_name) awhere b.tablespace_name = a.tablespace_name(+)and b.tablespace_name like upper('%&tablespace_name%')order by 5/=================@alltbsSELECT /* + RULE */ df.tablespace_name "Tablespace",df.bytes / (1024 * 1024) "Size (MB)",SUM(fs.bytes) / (1024 * 1024) "Free (MB)",Nvl(Round(SUM(fs.bytes) * 100 / df.bytes),1) "% Free",Round((df.bytes - SUM(fs.bytes)) * 100 / df.bytes) "% Used"FROM dba_free_space fs,(SELECT tablespace_name,SUM(bytes) bytesFROM dba_data_filesGROUP BY tablespace_name) dfWHERE fs.tablespace_name (+) = df.tablespace_nameGROUP BY df.tablespace_name,df.bytesUNION ALLSELECT /* + RULE */ df.tablespace_name tspace,fs.bytes / (1024 * 1024),SUM(df.bytes_free) / (1024 * 1024),Nvl(Round((SUM(fs.bytes) - df.bytes_used) * 100 / fs.bytes), 1),Round((SUM(fs.bytes) - df.bytes_free) * 100 / fs.bytes)FROM dba_temp_files fs,(SELECT tablespace_name,bytes_free,bytes_usedFROM v$temp_space_headerGROUP BY tablespace_name,bytes_free,bytes_used) dfWHERE fs.tablespace_name (+) = df.tablespace_nameGROUP BY df.tablespace_name,fs.bytes,df.bytes_free,df.bytes_usedORDER BY 4 DESC;========================@temptbsselect FILE_NAME,TABLESPACE_NAME,AUTOEXTENSIBLE from dba_temp_files where TABLESPACE_NAME='TEMP';=============freetbs====================@privs=========SEE PERMANENT DEFAUT TABLESPACE:===============================select default_tablespace,temporary_tablespace from dba_users where username=’SCOTT’;# To check default permanent tablespace and temporary tablespace================================================================select property_name,property_value from database_properties where property_name like ‘DEFAULT%’;# To change default permanent tablespace========================================alter database default tablespace mydata;# To change default temporary tablespace========================================alter database default temporary tablespace mytemp;# To check system privileges for a user:========================================select privilege from dba_sys_privs where grantee='&SCOTT';# To check object level privileges==================================select owner,table_name,privilege from dba_tab_privs where grantee='&SCOTT';# To check roles assigned to a user===================================select granted_role from dba_role_privs where grantee='&SCOTT';# To check permissions assigned to role=======================================select privilege from role_sys_privs where role='&MYROLE';select owner,table_name,privilege from role_tab_privs where role=’MYROLE’;select granted_role from role_role_privs where role='MYROLE';RMAN BACKUP:===========23:00cold and hot ==>file levelexport ====>table levelrman ===>block leveladv ===> speed,size reducedcontact bit map in datafile headerparallelsim: 10 process datafile scan acrossduplexing archive: if want to maintain two location if one corrupted oracle take caredetection : if data file curuptedvalidating : validation will give rmancontrolfile autobackup on :along with database back if u want to take control file backupautoback up: will go in to tap or diskDISK PARLLELISM: at a time 3 data file will scancomponents of rman:1. RMAN executable file ===> rman prompt2.target : abc is my database if want to take backup of abc it will become target database3. auxillary database: colnned copy of target4. recovery catalog :repository of it will store the backup of database5. media manger layer: configuration parameters:========================show all; (; mandatory)1. retention pocily: redundency: how many back to there def 1 recovery window: how many days RMAN> CONFIGURE RETENTION POLIICY TO RECOVERY WINDOW OF 90daysRMAN> configure channel device type disk format '/u01/rman_bkp/%T_%D_%U';redundency 32. configure backup optimization defalut off:file level bkp 10 gb back of yesterday. today datafile not changed (not use realtime)300 5 parsbt_tapeflash recovery area: it is a area when recovery req file will be therebackup piece: it is a file phybackup set: group of backup pieces logicalhow to increse the size of flash recovery:SQL> show parameter db_recovery_file_dest_sizename type valuedb_recovery_file_dest_size big interger 2GSQL> alter system set db_recovery_file_dest_size=10G scope=both;@archdestination----------------mkdir /u02/archivesSQL> alter system set log_archive_dest_1='location=/u02/archives' scope=both;alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';------------------------------------------------------------------------------------RMAN> BACKUP FORMAT='/U02/FULL_PRODB_%T.BKP' DATABASE PLUS ARCHIVELOG T IS THE REFERENCE NUMBER IT STORES THE TIMESTAMP WHAT TIME BACKUP TAKEN10g compressed backup:size of the backup peice reducedRMAN>backup as compressed backupset database plus archivelog14 to 2 gbRMAN> list backupthe info stored in control files from control file this info will getbskey typeofbackup size disk howmuchtimetaken(elapased) completedtimedue to some space issue u delted os levelrm yesterday directoryeven u tho u deleted but rman dont' know if u list backup it will give u deleted backup all soRMAN>Crosscheck backup ======verification of cmparing to 2 os level and db levelit make as expired RMAN> delete expired backup;it will ask promtRMAN>delete noprompt expired backup;RMAN>CROSSCHECK ARCHIVELOG ALL;RMAN> DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;RMAN> REPORT OBSOLETE;RMAN> DELETE NOPROMPT OBSOLETE;delete expired archivelog all;RMAN> BACKUP AS COPY DATABASE; FILE LEVEL BACKUP SIMILER TO HOT AND COLDBACKUPAFTER TAKING BACKUPRMAN>RESTORE DATABSAE VALIDATE; LAST BACKUP OF THE PEICES WILL BE VALIDATEDRMAN> VALIDATE BACKUPSET 23;BEFORE BACKUP ONLY WE CAN CHECK THE DATABSE==========RMAN>BACKUP VALIDATE DATABASE ARCHIVELOG ALL; DONT TAKE BACKUP JUST VALIDATELIST BACKUP BY FILE; # shows backup sets, proxy copies, and image copiesLIST COPY; # shows only disk copies******************************************************** RECOVERY ************************************************************************************************************************* *****************************************************************remove datafile at os levelrun block series of steps executionRMAN> run{sql 'alter tablespace users offline';restore tabelspace users;recover tablespace users;sql 'alter tablespace users online';}******************************************************** incremental *******************************************************today 100 gb tomorw 110 next 120today 1 hr takentomorrow more then one hourlevel 0 full backuprest of days incremental backupsunday full backupevery day incremental backup*****************************************today 500tomorr 510 i take only 10 of backup 1. diffential2. cumilative both have level 0 and 1fist time level 0backup incremetal levelo 0 database plus archivelog; differntial by defaultRMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE PLUS ARCHIVELOG; FASTTRMAN> BACKUP CUMULATIVE INCRENTAL LEVEL 0 DATABSAE PLUS ARCHVIVELOG;10G BLOCK CHAGE TRACINGIF BLOCK CHANGE IT PLACE IN A FILE WHEN U INITIATE RMAN TO GO TO THAT FILESQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/U02/TRACK.F';CTWR BACKGROUND PROCESS===========SHOW=================SHOW CHANNELSHOW DEFAULT DEVICE TYPESHOW BACKUP OPTIMIZATION============MONITERING RMAN======================V$PROCESS Identifies currently active processes.V$SESSION Identifies currently active sessions. Use this view to determinewhich database server sessions correspond to which RMAN allocated channels.V$SESSION_LONGOPS Provides progress reports on RMAN backup and restore jobs.V$SESSION_WAIT Lists the events or resources for which sessions are waiting.V$BACKUP_SYNC_IO Displays rows when the I/O is synchronous to the process (or thread on some platforms) performing the backupv$DATABASE_BLOCK_CURRPUTION : will update the rman errors=================CHANGE THE LOCATION=========================================****************==================You can view the current configuration values of all the RMAN parameters that you change fromtheir default values by using the V$RMAN_CONFIGURATION view======================================================@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@===============================================================@level1==============run{sql 'alter system switch logfile';sql 'alter system switch logfile';sql 'alter system switch logfile';allocate channel c1 device type disk;allocate channel c2 device type disk;allocate channel c3 device type disk;allocate channel c4 device type disk;allocate channel c5 device type disk;allocate channel c6 device type disk;allocate channel c7 device type disk;allocate channel c8 device type disk;backup as compressed backupset incremental level 1 database format '/u01/rman_bkp/level1_%d_%T_%s_%p' TAG='level1D';####backup format '/u01/rman_bkp/level1_arch_%d_%T_%s_%p' archivelog all delete input TAG='level1_arch_bkp';backup format '/u01/rman_bkp/level1_arch_%d_%T_%s_%p' archivelog all TAG='level1_arch_bkp';delete noprompt archivelog all completed before 'sysdate-6';backup current controlfile format '/u01/rman_bkp/ctrl_%d_%s.ctl';}==================================rman is a server manged backupRMAN> backup tablespace system;it will take backup of backup set control&spfile even control file auto backup off;RMAN> backup tablespace sysaux;it will take only one backup piece genarated. but if you make control file auto backup on then it takes control&spfile;if the control file autobackup is on and if you change any strutural change to db it take backup automatically.controfile autobackup off;RMAN>backup database plus archivelog; it take cotrol&spfile bcz we included system tablespace;crash databaseshut abort;remove file at physical localtions CRDSQL>startuperror 205 error identifying control file check alert logSQL>shutdown abortRMAN> startup nomount;RMAN> restore controlfile form '004LM'; ---YOU MUST KNOW THE PIECE NAMERMAN> alter database mount;rman> restore database;RMAN>recover database;RMAN>alter database open resetlogs;configure control file autobackup on:RMAN>backup database plus archivelog; --control&spfile takesquitSQL>shutdown abort;delete RCD FILESQL> startup errorHERE DBID REQRMAN> SET DBID 234546 ---FROM BACKUP U GET DBID APPENDSRMAN>startup nomount;Oracle instance startedRMAN> restore controlfile from autobackup; RMAN> alter database mount;RMAN> restore database;RMAN> recover database;RMAN> alter database open resetlogs;RMANBACKUP SCRIPTS:==============BACKUP VALIDATE:===============connect target /run { allocate channel ch1 type disk; allocate channel ch2 type disk; allocate channel ch3 type disk; allocate channel ch4 type disk; BACKUP VALIDATE CHECK LOGICAL database; release channel ch1; release channel ch2; release channel ch3; release channel ch4;}BACKUP ARCH:===========connect target /run { allocate channel ch1 type disk;allocate channel ch2 type disk;allocate channel ch3 type disk;backup as compressed backupsetformat '/ora_backup/%d_arc_t%t_s%s_p%p.bkp'filesperset=8(archivelog all delete input); release channel ch1;release channel ch2;release channel ch3;}BACKUP FULL:===========connect target /set snapshot controlfile name to '/oracle/bkp/controlfile_snapshot.ctl';run { allocate channel ch1 type disk;allocate channel ch2 type disk;allocate channel ch3 type disk;allocate channel ch4 type disk;allocate channel ch5 type disk;backup as compressed backupsetformat '/ora_backup/%d_dbf_t%t_s%s_p%p.bkp'filesperset=4database;sql 'alter system archive log current';release channel ch1;release channel ch2;allocate channel ch1 type disk;allocate channel ch2 type disk;backup as compressed backupsetformat '/ora_backup/%d_arc_t%t_s%s_p%p.bkp'filesperset=4(archivelog all delete input); release channel ch1;release channel ch2;release channel ch3;release channel ch4;release channel ch5;}run{crosscheck backup;delete noprompt obsolete;}BACKUP INCR_DIFF:================connect target /set snapshot controlfile name to '/oracle/bkp/controlfile_snapshot.ctl';run{crosscheck backup;delete noprompt obsolete;}run { allocate channel ch1 type disk format '/ora_backup/in_%d_dbf_t%t_s%s_p%p.bkp';allocate channel ch2 type disk format '/ora_backup/in_%d_dbf_t%t_s%s_p%p.bkp';allocate channel ch3 type disk format '/ora_backup/in_%d_dbf_t%t_s%s_p%p.bkp';allocate channel ch4 type disk format '/ora_backup/in_%d_dbf_t%t_s%s_p%p.bkp';allocate channel ch5 type disk format '/ora_backup/in_%d_dbf_t%t_s%s_p%p.bkp';allocate channel ch6 type disk format '/ora_backup/in_%d_dbf_t%t_s%s_p%p.bkp';BACKUP as compressed backupset INCREMENTAL LEVEL 1 DATABASE include current controlfile filesperset=8;sql 'alter system archive log current';backup as compressed backupsetformat '/ora_backup/%d_arc_t%t_s%s_p%p.bkp'filesperset=6(archivelog all delete input); release channel ch1;release channel ch2;release channel ch3;release channel ch4;release channel ch5;release channel ch6;}@DATAGAURD:==========DATA GAURD CONFIGURATION :====================================1. check archive log is onSELECT force_logging FROM v$database;2. SQL>alter database force logging; {redo entries will genarated} if the user connected issued dml and nologging3. SQL>select group#,members,sum(bytes/1024/1024) from v$log group by group#,members4. SQL>alter database add standby logfile group 4 '/u01/oradata/prodb/redo04.log' size 50m;SQL>alter database add standby logfile group 5 '/u01/oradata/prodb/redo05.log' size 50m;SQL>alter database add standby logfile group 6 '/u01/oradata/prodb/redo06.log' size 50m;5. SQL>select type from v$logfile;6. SQL>show parameter db_unique_name ===========>should show the instance name {database name should same in both primary and stand by}7. SQL>alter system set log_archive_config='DG_CONFIG=(proddb,standb)' scope=both;8. SQL>alter system set log_archvive_dest_1='location=/u02/archive VALID_FOR(ALL_LOGFILES,ALL_ROLES) db_unique_name=prodb' scope=both9. SQL>alter system set log_archive_dest_2='SERVICE=standb LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=stndb' scope=both10.show paramter log_archive_dest_state_111.show paramter log_archive_dest_state_2 should be enable both if not alter system set log_archive_dest_1 eable12. alter system set fal_server='standb' scope=both13. alter system set fal_client='prodb' scope=both14.alter system set standby_file_management=auto scope=both15.create pfile from spfile16. scp /u01/dbs/initprodb.ora oracle@19.168.1.11:/u01/initstandb.ora ======>check pfile copied or not17. open pfile18 above audit not required19. a dump and control file, flash recovery dbname sameservicename, db_unique_name prodbadd db_file_name_convert='/u01/oradata/proddb','/u01/oradata/standb'log_file_name_convert='/u01/oradata/proddb','/u01/oradata/standb'db_unique_name='standb'create nesseary direcotiesconfigure listner====configure tnsnamesexport oracle_sid=standbstartup nomountRMAN> duplicate target database for standby from active database nofilenamecheck;select name,open_mode from v$database;ps -ef|grep mrpalter database recover managed standby database disconnect from session;alter database recover managed standby database cancel;select max(sequence#) from v$log_history =========> sink where both r select name,database_role from v$database evn instace name also\show parameter log_archive_dest2 andselect name,database_role,protection_level from v$databasealter database recovery managed standby database cancelalter database recover managed standby database using current logfile disconnect from session; ========>realy time applysuppose primary side i recreated passwordfile sys123 with out inform created then not scpselect sequence#,archived,applied from v$archived_log achive=== logshipping applied===mrpQ;how to check logship and logapply are runingwhat to do if logshipping not applied (1.set alert log file both primary and secondery)2.if alter log 1034 show error in alert log file then copy the possword file primary to stand by3.if alter log show any error related to network then check listners are up and runing both sides and check the tnsping both sideif alter log shows heart beat fail error then check the value of db_unique_name paramer both primary and standbywhat to do if log apply not done?check mrp process is up and running or notsome time even mrp upandrunnig apply not work in both cases stop and start mrp@drillswithover:+++++++++select database_role,switchover_status from v$databaseAT PDC SITE: ===========1) alter database commit to swithover to physical standy with session shutdown2) shut immediate;3) startup mount;AT ODC SITE: ============1)alter database recover managed standby cancel;2)alter database commit to switchover to primary3)shut immediate;4)startup 5)alter database recover managed standby database disconnect from session;2:29V$DATAGUARD_STATS =================displays how much redo data generated by the primary database is not yet available on the standby database, showing how much redo data could be lost if the primary database were to crash at the time you queried this view. You can query this view on any instance of a standby database in a Data Guard configuration. If you query this view on a primary database, then the column values are cleared.v$recovery_progress can be used to monitoring database recovery operations, and gives us access to information like: Last Applied Redo, Active Apply Rate, Average Apply Rate, Apply Time per Log and a few more. The item we are interested in is “Last Applied Redo” and the value of the “TIMESTAMP” column. The value should be very close to or match the value of LAST_TIME column from v$standby_log view.SQL> select START_TIME,TYPE, ITEM,UNITS,SOFAR,TIMESTAMP 2 from v$recovery_progress where ITEM='Last Applied Redo';START_TIME TYPE ITEM UNITS TIMESTAMP------------------- ---------------- ------------------- --------- -------------------2013-04-17 22:46:26 Media Recovery Last Applied Redo SCN+Time 2013-04-18 20:26:16 v$Managed_standby=================V$MANAGED_STANDBY displays current status information for some Oracle Database processes related to physical standby databases in the Data Guard environment.This view does not persist after an instance shutdown.v$datagaurd_config=================Lists the unique database names defined with the DB_UNIQUE_NAME and LOG_ARCHIVE_CONFIG initialization parameters.v$log_history=============V$LOG_HISTORY displays log history information from the control file.v$archive_dest_status=====================V$ARCHIVE_DEST_STATUS displays runtime and configuration information for the archived redo log destinations. The information in this view does not persist across an instance shutdown.=======================convert snapshto database to physical standby============alter database convert to physical standby;alter database convert to snapshot standby======================prerequests============================1. Ensure Dbvisit Standby is no longer scheduled on the primary and standby servers.2. Ensure there is enough space on the standby server to receive the primary redo logs, and any new archive logs created.3. Ensure that the standby database is in archive log mode.4. Ensure there is sufficient space on the primary server for complete backups of the redo logs. Required space will be double the current redo log space requirements.5. The standby database must be up to date before starting the switchover process. Dbvisit Standby will check if this is the case and will not initiate the switchover if the standby database is not up to date.6. Oracle database parameters db_file_name_convert and log_file_name_convert must be set to default values (null strings) in the primary database prior to switchover.If either of the parameters are set to non null values in an Oracle database version 11 and higher that uses an spfile (not pfile), Dbvisit will automatically reset both parameters to default values during Graceful Switchover so no action is required.In case a primary database has version is 10 or lower, or a database uses a pfile, Graceful Switchover will terminate, and instructions to reset both parameters and restart the primary database will be displayed.4.ALLOCATE CHANEL C1 DEVICE TYPE DISK FORMAT '/U01/RMANBKP';BACKUP INCREMENT FROM SCN 102;5.ALTER DATABSAE CREATE STANDBY CONTROLFILE AS ='/PATH';6.SCP BACKUP AND CONTROL TO STAND BY 1.SELECT CURRENT_SCN FROM V$DATABASE2.ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL3.SHUT IMMEIDATE7.REPLACE CURRENT CONTROLFILE WITH 'PATH';8.STARTUP MOUNT9.ALTER DATABASE MOUNT STANDBY DATABASE10.CATALOG STARTWITH 'PATH'11.RECOVER DATABASE;12.ALTER DATABASE RECOVER MANAGED STANDBY DATABSAE DISCONNECT FROM SESSIONREGISTER REDOLOGS AT STANDBY:============================ ALTER DATABASE REGISTER LOGFILE '/physical_standby1/thread1_dest/arcr_1_7.arc';standby side:============dbname our primarydbfilename convert pri to standfalclient=standfalserver=primaycontrolfile change to standdst1 dst2 unique name change========================================================@zip@=====================================1.compresscompress abc ===>abc.zuncompress abc.z2. zip <filename.zip> actfile ===>abc.zipunzip abc.zp3.gzip abc ===>abc.gzgunzip abc.gzgzip `ls -ltr | grep -w "Feb" | awk '{print $NF}'`4.tar -cvf abc.tar foldername ===>abc.tartar -czvf archive.tar.gztar -xvf abc.tar for 3&4 you can give the destination ===============================================STATISTICS====================================================analyze table emp estimate statistics;exec dbms_stats.gather_table_stats('SCOTT','EMP',’’,40);INDEX=====analyze index pk_emp compute statistics;exec dbms_stats.gather_index_stats(‘SCOTT’,’PK_EMP’);SCHEMA=====exec dbms_stats.gather_schema_stats(‘SCOTT’);FULLDB=====exec dbms_stats.gather_database_stats;=============================================TUNING================================================if palntable not available execute below script@?/rdbms/admin/utlxplan.sqlexplain plan set statement_id='abc'for select *from tablename;@?/rdbms/admin/utlxpls.sqlexplain_plan==AWR:===SQL>@?/rdbms/admin/awrrpt.sqlreport type: htmlno of days:2begin snapid end snapidreportname: /home/oracle/abc_awrrpt.html=========================================@ADMIN RAC=============================srvctl======#to see configuration$srvctl config database -d hrms#to see status of all instances$srvctl status database -d hrms -- start or stop#to see status of specific instance$srvctl status instance -i hrms -d hrms#to see all services of database$srvctl status service -d hrms -- start or stop#to see status of asm$srvctl status asm -n lnx01 -- start or stop#to see status of nodeapps$srvctl status nodeapps -n lnx01 --start or stop#to stop listner$srvctl stop listner -n linx01 --stat or stopracservice$srvctl add service -s test -d hrms -r hrms1 -a hrms2 -P basic r=prefer#to see status of specific service$srvctl status service -s test -d hrms#to delete service$srvctl remove service -s test -d hrms#to disable enable instance$srvctl disable instance -d hrms#to register the database with cluster$srvctl add database -d crm -o $ORACLE_HOME#to register the instance with cluster$srvctl add instance -i crm -d crm -n lnx01#to ungister the entries$srvctl remove database -d crm#to know the configuration of scan listner$srvctl config scan_listner#to know the status of scan listner$srvctl status scan_listner---------------------------------------------@racsessions-----------selectinst_id,count(*)fromgv$sessionwhereusername is not nullgroup byinst_id;----------------------------------------------crsctl:======#to see version of cluster$crsctl query crs softwareversion$crsctl query crs activeversion#to stop cluster#cd /etc/init.d#./int.crs stop orcd $ORACLE_CRS_HOME/bin#./crsctl stop clusterin 11g ./crsctl stop cluster -all#to know the location of votiong disk$crsctl query crs votedisk#to know the location of ocr file$ocrcheck#to know olr$ocrcheck -local#to disable cluster$crsctl disable crs#to know the master node$ocrconfig -showbackup#to know the status of all resources that register with cluster$crs_stat -d#to dump the content of ocr into a text file#ocrdump#to know the number of nodes participating in cluster#olsnode#to check the status of cluster$crsctl check crs11g $crsctl check crs -all----------------------------------------$ crsctl get css disktimeoutCRS -4678: Successful get disktimeout 200 for Cluster Synchronization Services$ crsctl get css misscountCRS-4678: Successful get misscount 30 for Cluster Synchronization Services-------------------------------------------BACKUP IN RAC:=============OCR$ocrconfig -showbackupdefalut will be $ORA_CRS_HOME/cdata/lnx02/ocr001.ocr /day.ocr/week.ocrocrconfig -restore $ORA_CRS_HOME/cdata/lnx02/ocr001.ocr#to take ocrbackup manuall $ocrconfig -export /opt/ocr.bkp#to restore ocrbackup manuall$ocrconfig -import /opt/ocr.bkpVOTING FILE===========#dd if =/dev/sdb5 of=/opt/vote.bkp#to restore votefile#dd if=/opt/vote.bkp of=/dev/sdb5OLR===$ocrconfig -showbackup -local#to take backup of olr$ocrconfig -local -manualbakup#to restore olr$ocrconfig -local -restore <filepath>===================================DBSIZE===================================select"Reserved_Space(MB)", "Reserved_Space(MB)" - "Free_Space(MB)" "Used_Space(MB)","Free_Space(MB)"from(select(select sum(bytes/(1014*1024)) from dba_data_files) "Reserved_Space(MB)",(select sum(bytes/(1024*1024)) from dba_free_space) "Free_Space(MB)"from dual);==========================KILL===============alter system kill session '815,4221';PATH=$PATH:$HOME/binexport ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_homeexport PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin==========multipledumps==========expdp directory=EXP_IMP_DIR dumpfile=expdp_BR_%u.dmp logfile=expdp_BR.log tables=SFMSBR.MTB_MSG_TXT_BR filesize=2G parallel=4expdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_%u.dmp logfile=expdp_FULL.log filesize=2G parallel=4 FULL=Yexpdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_1%u.dmp logfile=expdp_FULL_1.log filesize=10G parallel=4 FULL=Yexpdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_%u.dmp logfile=expdp_FULL_1.log filesize=10G parallel=4 FULL=Yexpdp directory=EXP_IMP_DIR dumpfile=expdp_FULL_%u.dmp logfile=expdp_FULL_1.log filesize=10G FULL=Y=====================RMANRset lines 100 pages 100col STATUS format a9col min format 999.99select SESSION_KEY, INPUT_TYPE, STATUS,to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,to_char(END_TIME,'mm/dd/yy hh24:mi') end_time, round(elapsed_seconds/60,2) mis,round(OUTPUT_BYTES/1024/1024,2) "SizeMB" from V$RMAN_BACKUP_JOB_DETAILS order by session_key;============PAD WINDOWS run{shutdown immediate;startup mount;allocate channel c1 device type disk;backup as compressed backupset database format 'G:\Rman_Cold_bkp\SFMS\db_%d_%D_%M_%Y_%s.bkp';backup current controlfile format 'G:\Rman_Cold_bkp\SFMS\ctl_%d_%D_%M_%Y_%s.bkp';alter database open;}====== run{shutdown immediate;startup mount;allocate channel c1 device type disk;backup as compressed backupset database format 'G:\Rman_Cold_bkp\NEFT\db_%d_%D_%M_%Y_%s.bkp';backup current controlfile format 'G:\Rman_Cold_bkp\NEFT\ctl_%d_%D_%M_%Y_%s.bkp';alter database open;}run{allocate channel c1 device type disk;backup as compressed backupset database format 'G:\Rman_Cold_bkp\SFMS\db_%d_%D_%M_%Y_%s.bkp';backup current controlfile format 'G:\Rman_Cold_bkp\SFMS\ctl_%d_%D_%M_%Y_%s.bkp';}run{allocate channel c1 device type disk;backup as compressed backupset database format 'G:\Rman_Cold_bkp\NEFT\db_%d_%D_%M_%Y_%s.bkp';backup current controlfile format 'G:\Rman_Cold_bkp\NEFT\ctl_%d_%D_%M_%Y_%s.bkp';}=============RMANCHECK====================set lines 100 pages 100col STATUS format a9col min format 999.99select SESSION_KEY, INPUT_TYPE, STATUS,to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,to_char(END_TIME,'mm/dd/yy hh24:mi') end_time, round(elapsed_seconds/60,2) mis,round(OUTPUT_BYTES/1024/1024,2) "SizeMB" from V$RMAN_BACKUP_JOB_DETAILS order by session_key;===========================================================set lines 100 pages 100col STATUS format a9col min format 999.99select SESSION_KEY, INPUT_TYPE, STATUS,to_char(START_TIME,'mm/dd/yy hh24:mi') start_time,to_char(END_TIME,'mm/dd/yy hh24:mi') end_time, round(elapsed_seconds/60,2) mis,round(OUTPUT_BYTES/1024/1024,2) "SizeMB" from V$RMAN_BACKUP_JOB_DETAILS order by session_key;PDCS3V3:/app/scr #PDCS3V3:/app/scr #PDCS3V3:/app/scr #PDCS3V3:/app/scr # cat long.sql=========================set lines 150select SID, SERIAL#, opname, START_TIME,TOTALWORK, sofar, (sofar/totalwork) * 100 done,TIME_REMAINING/60 "Re Minute"from v$session_longopswhere totalwork > sofarAND opname NOT LIKE '%aggregate%';==================$$$$$$$$$$$$$$$$$$=============SELECTopname,target,ROUND((sofar/totalwork),4)*100 Percentage_Complete,start_time,CEIL(time_remaining/60) Max_Time_Remaining_In_Min,FLOOR(elapsed_seconds/60) Time_Spent_In_MinFROM v$session_longopsWHERE sofar != totalwork;================0000000000000000000 PAD BACKUP 00000000000000000000=================@echo OFFset host=%COMPUTERNAME%set oracle_home=E:\app\Administrator\product\11.2.0\db_1#set backupstr="SFMS_%host%_%pdate%_%ptime%"#set backupstr=%backupstr:/=-%set dirname=Y:\EXPORTBKPset dirname1=Y:\RMANCOLDBKPmd %dirname1%\SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%set oracle_sid=sfmsexpdp 'sys/sys@SFMS as sysdba' DIRECTORY=DATA_PUMP_DIRECTORY DUMPFILE=SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%.dmp LOGFILE=SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%.log full=yrman target 'sys/sys as sysdba' cmdfile 'H:\RMAN_COLD_BKP_RP\rmancold_sfms' log=Y:\RMANCOLDBKP\SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%\SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%_rmancold.logecho User exeuting backup is: %DB_USERNAME% >> Y:\RMANCOLDBKP\SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%\SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%_rmancold.logmove H:\Rman_Cold_bkp\SFMS\*.BKP Y:\RMANCOLDBKP\SFMS_%host%_%pdate%_%ptime%_%DB_USERNAME%\move H:\Rman_Cold_bkp\dpdump\*.DMP Y:\EXPORTBKP\move H:\Rman_Cold_bkp\dpdump\*.log Y:\EXPORTBKP\=========^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^================================@snapshot standbySteps to convert physical standby to snapshot standby and then again revert it to physical standbyIf below parameters are already set then no need for below changes or else set below parameters before start as it should be required for snapshot standbyalter system set db_recovery_file_dest_size=4GB;alter system set db_recovery_file_dest='PATH;alter database recover managed standby database cancel;shutdown immediate;startup mount;alter database convert to snapshot standby;shutdown immediate;startup;*/ ----Ash Application team to do their testing once they will finish with their testing follow below step for converting snapshot standby to physical standby ---*/shutdown immediate;startup mount;alter database convert to physical standby;Shutdown immediate;startup mount;alter database recover managed standby database disconnect from session;catalog device type 'SBT_TAPE' backuppiece 'NEFTDB_03_01_2015_1765.bkp';======= RMAN ARCHIVE DELETIONSdelete archivelog until time = 'sysdate-12' backed up 1 times to disk ;delete archivelog all backed up 1 times to device type SBT;delete archivelog all completed before 'sysdate';delete archivelog all backed up 2 times to DEVICE TYPE disk; completed before 'sysdate-1';delete archivelog all backed up 1 times to DEVICE TYPE disk completed before 'sysdate';delete archivelog until time 'sysdate' backed up 1 times to disk;delete archivelog all backed up 2 times to sbt;run{allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo-MWF.opt)';delete archivelog all backed up 2 times to device type sbt;release channel t1;}run{allocate channel t1 type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo-TTS.opt)';catalog backuppiece 'SFMSDBRPT_04_04_2015_242.bkp';release channel t1;}alter system set log_archive_dest_state_2=DEFER scope=both;alter system set log_archive_dest_state_3=DEFER scope=both;============================================CONVERTING PHYSICAL STANDBY DATABASE TO SNAPSHOT STANDBY DATABASEhttp://www.orafaq.com/node/2505alter system set log_archive_config='DG_CONFIG=(SFMS_BEL,SFMS_KHAR,SFMS_NAG,SFMS_KHR)' scope=both;alter system set log_archive_dest_4='SERVICE=SFMS_KHR LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SFMS_KHR' scope=both;alter system set log_archive_dest_state_4=DEFER scope=both;alter system set log_archive_dest_state_4=ENABLE scope=both;alter database recover managed standby database cancel;shut immediate;startup nomount;alter database mount standby database;alter database convert to snapshot standby;alter database open;shut immediate;startup nomount;alter database mount;alter database convert to physical standby;shut immediate;startup nomount;alter database mount standby database;NORMAL Standby : ALTER DATABASE RECOVER managed standby database disconnect from session;REAL-TIME APPLY : ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;SELECT dest_id,max(SEQUENCE#) FROM V$ARCHIVED_LOG where applied='YES' group by dest_id;select name,open_mode,controlfile_type,database_role from v$database;SELECT PROCESS, STATUS,sequence# FROM V$MANAGED_STANDBY;set lines 200set pages 200col DEST_NAME for a30PROD : select dest_id,DEST_NAME,STATUS,DB_UNIQUE_NAME,RECOVERY_MODE,DATABASE_MODE,error from v$archive_dest_status;PROD : SELECT dest_id,max(SEQUENCE#) FROM V$ARCHIVED_LOG where applied='YES' group by dest_id;STANDBY : select * from v$dataguard_stats;=====DATAGAURD Stopping & Starting Process:Stopping1)SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;Canceling recover operation.2)ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;3)SELECT NAME, SEQUENCE#, ARCHIVED, APPLIED FROM V$ARCHIVED_LOG;4)SHUTDOWN IMMEDIATE;------Starting1)STARTUP NOMOUNT;2)ALTER DATABASE MOUNT STANDBY DATABASE;3)ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;ALTER DATABASE RECOVER managed standby database disconnect from session;alter database recover managed standby database cancel;SELECT dest_id,max(SEQUENCE#) FROM V$ARCHIVED_LOG where applied='YES' group by dest_id;select DEST_ID,DATABASE_MODE,ERROR,DB_UNIQUE_NAME from v$archive_dest_status;=================================================@drerrorset lines 200set pages 200col DEST_NAME for a30select dest_id,DEST_NAME,STATUS,DB_UNIQUE_NAME,RECOVERY_MODE,DATABASE_MODE,error from v$archive_dest_status;=====================================================@DRDrill Swicthover@switchover:+++++++++set lines 200set pages 200col host_name for a20select instance_name,host_name,name,open_mode,log_mode,database_role,switchover_status from v$database,v$instance;AT PDC SITE: it will become standby===========1) alter database commit to switchover to physical standby with session shutdown;2) shut immediate;3) startup nomount;4) alter database mount standby database; 5) alter database recover managed standby database disconnect from session;AT ODC SITE: it will become primary============1)alter database recover managed standby database cancel;2)alter database commit to switchover to primary;3)shut immediate;4)startup swithBack:++++++++++AT ODC SITE: this is primary ============1) alter database commit to switchover to physical standby with session shutdown;2) shutdown immediate;3) startup mount;4) alter database recover managed standby database disconnect from session;AT PDC SITE: this is standby===========1)alter database recover managed standby database cancel;2)alter database commit to switchover to primary;3)shutdown immediate;4)startup;NOte: onece it open we need to start recover at standby sideRajwinderOn Primary: SQL> Set lines 200 pages 50 SQL > select dest_id,STATUS,database_mode,recovery_mode, archived_seq#, error,gap_status from v$archive_dest_status; SQL > select thread#, max(sequence#) "Last Primary Seq Generated" from v$archived_log val, v$database vdb where val.resetlogs_change# = vdb.resetlogs_change# group by thread# order by 1; On Standby: select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" , almax-lhmax "Sequence Difference" from (select thread# thrd, max(sequence#) almax from v$archived_log where resetlogs_change#=(select resetlogs_change# from v$database) group by thread#) al, (select thread# thrd, max(sequence#) lhmax from v$log_history where resetlogs_change#=(select resetlogs_change# from v$database) group by thread#) lh where al.thrd = lh.thrd; SQL> select PROCESS,STATUS,THREAD#,SEQUENCE#,BLOCK#,BLOCKS from v$managed_standby where process like '%MRP%'; @pending arch:--------------set linesize 1200set pagesize 1200select * from (select sequence#,archived,applied from v$archived_log order by sequence# desc) where rownum<=20 order by rownum desc;=====================================================================expdp directory=EXPDP_DIR dumpfile=NTT_NIL_TRN_TBL1.dmp logfile=NTT_NIL_TRN_TBL1.log TABLES=NEFT.NTT_NIL_TRN_TBLdate +%d%m%Y_%H%M%SFor ORA-03137 : TTC Protocol :: Bug 8625762=====================================================================To be executed on : 172.22.196.201 NEFT & SFMS Reporting DB Server on 03-Feb-2015export ORACLE_SID=NEFTexpdp directory=EXPDP_FULL dumpfile=NEFT_FULL_03FEB2015_%U.dmp logfile=NEFT_FULL_03FEB2015.log FULL=Y COMPRESSION=ALL parallel=4 filesize=20Gexport ORACLE_SID=SFMSexpdp directory=EXPDP_FULL dumpfile=SFMS_FULL_03FEB2015.dmp logfile=SFMS_FULL_03FEB2015.log FULL=Y COMPRESSION=ALL$ cd /backup$ mkdir TESTSQL> create directory EXPDP_FULL1 as '/backup/TEST';$ expdp directory=EXPDP_FULL1 dumpfile=SFMSBR_24Apr2015_%U.dmp logfile=SFMSBR_24Apr2015.log schemas=SFMSBR COMPRESSION=ALL parallel=4 filesize=15G==========================================================================================---- FULL DB BACKUP ----vi ncat_lvl0_backup_CDBD_disk.cmdCONFIGURE CONTROLFILE AUTOBACKUP ON;run {allocate channel 'D1' type DISK FORMAT '/b001/rman/CDBD/hot/lvl0_DB_%d_%c_%U_%D%M%Y.bak';allocate channel 'D2' type DISK FORMAT '/b001/rman/CDBD/hot/lvl0_DB_%d_%c_%U_%D%M%Y.bak';allocate channel 'D3' type DISK FORMAT '/b002/rman/CDBD/hot/lvl0_DB_%d_%c_%U_%D%M%Y.bak';sql 'alter system archive log current';set controlfile autobackup format for device type disk to '/b001/rman/CDBD/hot/cf_%F'; backup incremental level 0 as compressed backupset database plus archivelog skip inaccessible;sql 'alter system archive log current';copy current controlfile to '/b001/rman/CDBD/hot/CDBD_control_hot_%t.ctl';release channel 'D1';release channel 'D2';release channel 'D3';}CONFIGURE CONTROLFILE AUTOBACKUP ON;exit---- ARCH Backup ----vi ncat_arch_backup_CDBD_disk.cmdconfigure controlfile autobackup off;run {allocate channel D1 device type disk;sql 'alter system archive log current';backup as compressedbackupset format '/b001/rman/CDBD/arch/CDBD_003_arch_ncat_DB_%d_%F_%p.bak'archivelog all not backed up 1 times;delete noprompt force archivelog all backed up 1 times to device type disk;sql 'alter system archive log current';allocate channel 'D2' type disk;copy current controlfile to '/b001/rman/CDBD/control/CDBD_control_hot_%t.ctl';release channel 'D2';release channel 'D1';}configure controlfile autobackup on;exit======================DELETE ARCHIVELOG UNTIL SEQUENCE = 75200;delete archivelog until time = 'sysdate-1' backed up 1 times to sbt_tape ;delete archivelog all backed up 1 times; before 'sysdate';delete archivelog all not backed up 2 times to device type sbt_tape;delete archivelog all completed before 'sysdate-1';======================Delete from TAPE, where backup OLDER then 17 Days (sysdate - 17)bash-4.2$ cat /sd_oraBkp/DBA_Activity/DBA_Script/config/delete_RMANBKP_TAPE.sh#---Export current datedy=`date "+%d%m%y-%H%M"`export dyecho "Starting Backup HouseKeeping Activity" > /sd_oraBkp/DBA_Activity/rman_bkp/obsolete_log/rman_deletion_tape_$dy.logecho "*************************:CHECKING THE OBSOLETE BACKUP AND DELETING THE OBSOLETE BACKUP:****************************"#---RMAN full backup script#---Connect Target Database and Create RMAN Log Filerman TARGET / << EOF>>/sd_oraBkp/DBA_Activity/rman_bkp/obsolete_log/rman_deletion_tape_$dy.logallocate channel for maintenance device type 'sbt_tape' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';list backup completed before 'sysdate-17';delete noprompt backup completed before 'sysdate-17';exit;eofbash-4.2$ cd /sd_oraBkp/DBA_Activity/rman_bkp/obsolete_log/======================delete archivelog all backed up 1 times to device type Sbt_Tape;FULL_BKP_%d_set%s_piece%p_%T_%U for backupsets when duplexing is not used. For duplexing backup it would be FULL_BKP_%d_set%s_piece%p_copy%c_%T_%U•%d : name of database•%s :backup set number. (Unique for controlfile lifetime)•%p :piece number in backup set.•%T : Specified date in format YYYYMMDD•%U : Unique number consist of %u_%p_%c•%c : copy number of backup piece.when duplexing of backup If no format is specified, Oracle by default uses %U.For controlfile autobackup, I prefer to use default config which is %F.This tag has DBID in the filename which would be necessary in the case of recovery when RMAN catalog is not accessible.This tag can not be used for backup sets.==========================================================================================orakill@logonSELECT s.inst_id,s.sid,s.serial#,p.pid,p.spid,s.username,s.program,s.osuserFROM gv$session sJOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id;-- WHERE s.type != 'BACKGROUND';SELECT s.inst_id,s.sid,s.serial#,p.pid,p.spid,s.username,s.programFROM gv$session sJOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_idwhere p.spid = 11222;-------------------------------------------------------------------------------------------------------------------------------------------crontab setting00 20 01 03 * /u01/app/oracle/global/bin/rman/scripts/backup_db_logwatcher.ksh cdbp2 levl0_cdbp2_2tape.cmd >/dev/null* * * * * *| | | | | | | | | | | +-- Year (range: 1900-3000)| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)| | | +------ Month of the Year (range: 1-12)| | +-------- Day of the Month (range: 1-31)| +---------- Hour (range: 0-23)+------------ Minute (range: 0-59)434779241BEGINDBMS_STATS.gather_table_stats('RSPROD_ARCH', 'REQUEST',ESTIMATE_PERCENT => 0.1, METHOD_OPT => 'FOR COLUMNS CLOSEDDATE SIZE 254');END;/select count(*) from V$FAST_START_TRANSACTIONS;file://C:\Program Files (x86)\lucky leap\bin\Pac9064.jshttp://autocache.hp.com/HP LAPTOP 15R014tx=====================================oradw @ sf03s03xxd07:cmfd1[/home/ais/oradw]$tokill=`ps -fea|grep mon_ts|awk '{ printf $2" "}'`; kill -9 $tokill;======================================== landed in similar situation.I executed command nid target=sys/pnt4vm dbname=PNT4VMbefore renaming/creating the tempfile and was struck with error.NID-00111: Oracle error reported from target database while executingbegin dbms_backup_restore.nidprocessdf(:fno, :istemp, :skipped, :idchged, :nmchged); end;ORA-01116: error in opening database file F:\ORACLE\ORADATA\PNT4\TEMP02.DBFORA-27041: unable to open fileOSD-04002: unable to open fileO/S-Error: (OS 3) The system cannot find the path specified.ORA-06512: at "SYS.X$DBMS_BACKUP_RESTORE", line 6164ORA-06512: at line 1WorkAround.This is what I understood.If I try reverting (nid target=sys/pnt4vm REVERT=Y) the revert process agains fails. But it reverts all the datafiles except file 01 i.e. SYSTEM.DBF. So as a workaround, I performed following steps.1) Executed the command nid target=sys/pnt4vm dbname=PNT4VMThis will fail.2) Shut down the database.3) Take Backup of Existing control file.4) Generate trace for Control file.5) Remove the existing control files.6) Edit the parameter file with new DB_NAME7) Start the Instance in Nomount Stage.8) Create the control files with SET option. (New DB NAme)9) Open database with Resetlogs.10) Add the tempfiles to temp tablespace.=============================================================RDADFSprod_sysOVSsys==========================================================================DATAGAURD Stopping & Starting Process:Stopping1)SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;Canceling recover operation.2)ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;3)SELECT NAME, SEQUENCE#, ARCHIVED, APPLIED FROM V$ARCHIVED_LOG;4)SHUTDOWN IMMEDIATE;------Starting1)STARTUP NOMOUNT;2)ALTER DATABASE MOUNT STANDBY DATABASE;3)ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;ALTER DATABASE RECOVER managed standby database disconnect from session;alter database recover managed standby database cancel;========================================================================================================================col name for a50SELECT NAME, max(SEQUENCE#), ARCHIVED, APPLIED FROM V$ARCHIVED_LOG where applied='YES' and name not like '%sd_ora%'group by name, ARCHIVED, APPLIED;SELECT max(SEQUENCE#) FROM V$ARCHIVED_LOG where applied='YES';alter system set log_archive_config='DG_CONFIG=(SFMS_BEL,SFMS_KHAR,SFMS_NAG,SFMS_KHR)' scope=both;alter system set log_archive_dest_4='SERVICE=SFMS_KHR LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=SFMS_KHR' scope=both;alter system set log_archive_dest_state_4=DEFER scope=both;alter system set log_archive_dest_state_4=ENABLE scope=both;CREATE OR REPLACE PROCEDURE TRUNCATE_TABLE_PROC (oname IN varchar2, tname IN varchar2 ) as /********************************** AUTHOR JP Vijaykumar Oracle DBA DATE 10-05-2006 **********************************/ begin execute immediate 'truncate table '||oname||'.'||tname; exception when others then raise_application_error(-20001,'Insufficient privileges'); end; The above truncate table procedure is a simple procedure. Whoever is granted EXECUTE privileges on the procedure can truncate any table in the database.===== WEUP Proc. ======================================================1-- Truncating Procedure Will created by Oracle DBACREATE PROCEDURE IWAM_STG.TRUNC_DEL_TABLE (btch IN number) as begin delete from iwam_stg.load_status_as400 where batch_id = btch;commit; execute immediate 'truncate table IWAM_STG.unified_data_as400';exception when others then EXCEPTION WHEN OTHERS THEN RAISE_APPLICATION_ERROR (-20001, btch || ':$:' || SQLERRM, TRUE) ; end IWAM_STG.TRUNC_DEL_TABLE; /2-- Privilege granted to XYZ_User by Oracle DBA on this Truncate procgrant execute on IWAM_STG.TRUNC_DEL_TABLE to XYZ_User;3-- Execute Backup & Truncate and deleting procedure in XYZ_User with BATCH_ID Parameter in brackets () to be deleted, from single script created by UsA. vi rr.sh <== If running from Oracle DB Server, other / Oracle Usera. export ORACLE_HOMEb. export ORACLE_SIDc. expdp xyz_user/xyz_user directory=XYZ_EXPDP filename=Table2_$DT.dmp logname=Table2_$DT.log schemas=iwam_stg tables=(IWAM_STG.unified_data_as400,iwam_stg.load_status_as400)d. gzip Table2_$DT.dmpe. sqlplus xyz_user/xyz_user @trunc_del_Proc.sql e.1. vi trunc_del_Proc.sql ==> execute IWAM_STG.TRUNC_DEL_TABLE(874); OR OR OR B. execute IWAM_STG.TRUNC_DEL_TABLE(874); <== If running from TOAD / SQL Developer / etc... & not from logging on to Oracle DB Server=====================================@listenerpurgingLSNRCTL> set Log_status offLSNRCTL> status --check the path of listenerlogLSNRCTL> exitTest $> mv listener.log listener_old.logTest $> touch listener.logTest $> lsnrctlLSNRCTL> set Log_Status onLSNRCTL> exit====================================& set LOGGING_LISTENER=OFF in the listener.ora file to stop the listener logging.=========================================================00 00,01,02,03,04,05,06,07 27 12 * /u02/orashare/oracle/scripts/dbei/gen200/prd/bin/cronstub.ksh /u02/orashare/oracle/scripts/dbei/ora225/prd/bin/rman.ksh pfubsfll RMAN_Backup/runarchivebkup.rman -n > /u02/orashare/oracle/scripts/dbeiwork/rmanlogs/runarchivebkup_pfubsfll.lst 2>&1-- All versions. TRACESQL> ALTER SESSION SET sql_trace=TRUE;SQL> ALTER SESSION SET sql_trace=FALSE;SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => TRUE);SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => FALSE);hyh SQL> ALTER SESSION SET EVENTS '10046 trace name context forever, level 8';SQL> ALTER SESSION SET EVENTS '10046 trace name context off';@traceuserSQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>TRUE);SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>FALSE);SQL> EXEC DBMS_SYSTEM.set_ev(si=>123, se=>1234, ev=>10046, le=>8, nm=>' ');SQL> EXEC DBMS_SYSTEM.set_ev(si=>123, se=>1234, ev=>10046, le=>0, nm=>' ');-- Available from SQL*Plus since 8i (commandline utility prior to this.SQL> CONN sys/password AS SYSDBA; -- User must have SYSDBA.SQL> ORADEBUG SETMYPID; -- Debug current session.SQL> ORADEBUG SETOSPID 1234; -- Debug session with the specified OS process.SQL> ORADEBUG SETORAPID 123456; -- Debug session with the specified Oracle process ID.SQL> ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12;SQL> ORADEBUG TRACEFILE_NAME; -- Display the current trace file.SQL> ORADEBUG EVENT 10046 TRACE NAME CONTEXT OFF;-- All versions, requires DBMS_SUPPORT package to be loaded.SQL> EXEC DBMS_SUPPORT.start_trace(waits=>TRUE, binds=>FALSE);SQL> EXEC DBMS_SUPPORT.stop_trace;SQL> EXEC DBMS_SUPPORT.start_trace_in_sessivx'bon(sid=>123, serial=>1234, waits=>TRUE, binds=>FALSE);SQL> EXEC DBMS_SUPPORT.stop_trace_in_session(sid=>123, serial=>1234);tkprof dev1_ora_367660.trc translated.txt explain=test/test table=sys.plan_table sys=no waits=yesORADEBUG SETOSPID 11228;ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12;ORADEBUG TRACEFILE_NAME;ORADEBUG EVENT 10046 TRACE NAME CONTEXT OFF;=== Rename DB P44 to T44, by NIDnid target=/ DBNAME=T44nid target=/ DBNAME=metad1=============================oradim -NEW -SID P36===============================ed largeset pagesize 100set linesize 500col sid format 99999col username format a10 truncatedcol status format a1 truncatedcol logon format a19col idle format a9col program format a30 truncatedcol running_since format a15col event format a35selectTO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI'),a.inst_id,a.sid,a.event,a.username,a.status,a.sql_hash_value,to_char(logon_time,'dd-mm-yy hh:mi:ss') "LOGON",floor(last_call_et/3600)||':'||floor(mod(last_call_et,3600)/60)||':'||mod(mod(last_call_et,3600),60) "RUNNING_SINCE",a.programfromgv$session a wherea.type='USER'AND floor(last_call_et/3600)*60+floor(mod(last_call_et,3600)/60) > 10AND a.STATUS = 'ACTIVE'AND a.SID > 10order by a.last_call_et/OWIP 426 Serverbash-3.2$ cat rr_rman.shecho "" > rr.shBCKUP_DIR=/b01/rman/PNEOLOG/archcd $BCKUP_DIRecho "`pwd`"LSL=`ls *.bak`echo "LSL : $LSL"cd $BCKUP_DIR >> rr.shfor filename in $LSLdoecho "Processing : $filename"echo "gzip $filename "echo "gzip $filename &" >> rr.shdonechmod 755 rr.sh./rr.sh &================create or replace trigger LOGG_TRAIL before alter on database when (ora_dict_obj_type = 'USER' and ora_dict_obj_name != user and sys_context('USERENV','ISDBA') = 'FALSE' ); declare by_user varchar2(30); to_user varchar2(30); vprofile varchar2(30); begin select to.PROFILE into vprofile from DBA_USERS by, DBA_USERS to where by.USERNAME = user and to.USER_NAME = ora_dict_obj_name and by.PROFILE = to.PROFILE; insert into TRAIL_TEMP (USER_ALTERED, PASSWORD_MODIFIED_BY, PASSWORD_MODIFIED_DATE, PROFILE) values (ora_dict_obj_name, user, sysdate, vprofile); exception when others then raise_application_error (-20001,'can''t alter user'); end; /select to.PROFILEfrom DBA_USERS by, DBA_USERS to where by.USERNAME = user and to.USER_NAME = ora_dict_obj_name and by.PROFILE = to.PROFILE; find / -name "mailx" 2>/dev/nullecho "This is the body."| mailx -s "mailx Test1" ronak.darji@hp.com 2> ./rr.outecho "This is the body."| /usr/bin/mailx -s "mailx Test1" ronak.darji@hp.com 2> ./rr.outecho "This is the body."| /bin/mailx -s "mailx Test1" ronak.darji@hp.com 2> ./rr.out/bin/mailx -r oracle@o-i.com -s "RMAN Backup SUCCESSFUL" ronak.darji@hp.com anup.biswas@hp.com < ./testMail.out/bin/mail -s "RMAN FAILURE (${HN}:${ORACLE_SID}) " `cat /u001/app/oracle/dba/dba_fail.lst|grep -v "#"` -- -f rman@convatec.com < ${RMAN_LOG_FL}/bin/mail -s "RMAN FAILURE : TEST rr" ronak.darji@hp.com anup.biswas@hp.com -- -f ronak.darji@hp.com < ./dead.letterSQL> select name,state,total_mb,free_mb from gv$asm_diskgroup;NAME STATE TOTAL_MB FREE_MB------------------------------ ----------- ---------- ----------DATA MOUNTED 379276 378867FRA MOUNTED 28610 26008DATA DISMOUNTED 0 0FRA DISMOUNTED 0 0SQL> drop diskgroup FRA including contents;Diskgroup dropped.SQL> select name,state,total_mb,free_mb from gv$asm_diskgroup;NAME STATE TOTAL_MB FREE_MB------------------------------ ----------- ---------- ----------DATA MOUNTED 379276 378867DATA DISMOUNTED 0 0SQL> drop diskgroup DATA including contents;Diskgroup dropped.SQL> select name,state,total_mb,free_mb from gv$asm_diskgroup;no rows selectedUMG - Donot Close CLOSE only RESOLVE*************************************************************************************************************echo "=================================================================" >> ./cp_rr.logecho "===========S T A R T :- `date` ============" >> ./cp_rr.logecho "Enter Date of the Files needs to be COPIED e.g Feb 11 or Feb 2"read dg1mkdir cp_rrfn1=`ls -ltr | grep "$dg1" | sed "s/ /;/g" | sed "s/ /;/g" | sed "s/ /;/g" | sed "s/;;;/;/g" | sed "s/;;/;/g" | sed "s/;;/;/g" | cut -d';' -f9`##echo "dg1"ls -ltr | grep "$dg1"ls -ltr | grep "$dg1" >> ./cp_rr.logecho " "echo " " >> ./cp_rr.logecho "================================================================="echo "===========S T A R T :- `date` ============"for filename in $fn1docp $filename cp_rr/echo "File COPIED :- $filename"echo "File COPIED :- $filename" >> ./cp_rr.logdoneecho "============= E N D :- `date` ============" >> ./cp_rr.logecho "============= E N D :- `date` ============"*************************************************************************************************************Script Deletes only required dated Files onlyoracle@ustlvoi424>/export/home/oracle>cat Del_rr.shecho "=================================================================" >> ./Del_rr.logecho "===========S T A R T :- `date` ============" >> ./Del_rr.logecho "Enter Date of the GZ Files needs to be deleted e.g Feb 11 or Feb 2"read dg1fn1=`ls -ltr *.gz | grep "$dg1" | sed "s/ /;/g" | sed "s/ /;/g" | sed "s/ /;/g" | sed "s/;;;/;/g" | sed "s/;;/;/g" | cut -d';' -f9`##echo "dg1"ls -ltr *.gz | grep "$dg1"ls -ltr *.gz | grep "$dg1" >> ./Del_rr.logecho " "echo " " >> ./Del_rr.logecho "================================================================="echo "===========S T A R T :- `date` ============"for filename in $fn1dorm $filenameecho "File Deleted :- $filename"echo "File Deleted :- $filename" >> ./Del_rr.logdoneecho "============= E N D :- `date` ============" >> ./Del_rr.logecho "============= E N D :- `date` ============"*************************************************************************************************************echo "=================================================================" >> ./GZIP_rr.logecho "===========S T A R T :- `date` ============" >> ./GZIP_rr.logecho "Enter Files Extension needs to be GZIPPED e.g dmp"read dg1fn1=`ls *.$dg1`cnt=`ls *.$dg1 | wc -l`echo "fn1 : $fn1 : $cnt"for filename in $fn1doecho "Pending $dg1 Files to be GZIPPED : $cnt"cnt=`expr $cnt - 1`gzip $filenameecho "File GZIPPED :- $filename"echo "File GZIPPED :- $filename" >> ./GZIP_rr.logdoneecho "============= E N D :- `date` ============" >> ./GZIP_rr.logecho "============= E N D :- `date` ============"*************************************************************************************************************/u07/oraexport/pfcdb/GZIP_rr.sh > /u07/oraexport/pfcdb/GZIP_rr1.log 2> /u07/oraexport/pfcdb/GZIP_rr1.err &CONVERTING from RAC to NON-RAC, Online Redo Log file dropping from THREAD 2 / NODE 2SQL> select THREAD#, STATUS, ENABLED2 from v$thread;THREAD# STATUS ENABLED---------- ------ --------1 OPEN PUBLIC2 CLOSED PRIVATESQL> select group# from v$log where THREAD#=2;GROUP#----------456SQL> alter database disable thread 2;Database altered.SQL> alter database clear unarchived logfile group 4; ( repeat for 4 to 6)Database altered.SQL> alter database drop logfile group 4; ( repeat for 4 to 6)Database altered.- Now you can remove the undo tablespaces of other instances.SQL> show parameter undo;NAME TYPE VALUE------------------------------------ ----------- ------------------------------undo_management string AUTOundo_retention integer 900undo_tablespace string UNDOTBS1SQL> select tablespace_name from dba_tablespaces where contents='UNDO';TABLESPACE_NAME------------------------------UNDOTBS1UNDOTBS2SQL> drop tablespace UNDOTBS2 including contents and datafiles;Tablespace dropped. **************************************************************cat db_mon.cfg | grep 15m | grep -v ^"#" | grep -v l$select table_name,partition_name,SUBPARTITION_COUNT,HIGH_VALUE,TABLESPACE_NAME,last_analyzed from dba_tab_partitions where table_name='&SMA_FAC_DIG_SALES';========ORACLE GRID & DB HOME PSU Patchopatch lsinventory -detail@cpupatch:----------unzip p21972320_112040_AIX64-5L.zipcd 21972320 export PATH=$ORACLE_HOME/OPatch:$PATHopatch lsinventoryopatch versionopatch prereq CheckConflictAgainstOHWithDetail -ph ./opatch napply -skip_subset -skip_duplicateopatch lsinventory | grep appliedopatch versionsqlplus / as sysdba@?/rdbms/admin/catbundle.sql cpu apply@?/rdbms/admin/utlrp.sqlset lines 200set pages 200set time oncol ACTION_TIME for a35col ACTION for a12col NAMESPACE for a12col VERSION for a12col COMMENTS for a30col BUNDLE_SERIES for a10select * from registry$history;$ opatch version$ opatch lsinventory###########################################################################3#opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./13696242opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./.As root user execute:# opatch auto <UNZIPPED_PATCH_LOCATION> -oh <ORACLE_HOME>echo $PATHexport PATH=/u01/app/crs/11.2.0.3/grid/OPatch:$PATHcd <PSU_Location>opatch auto <PSU_Location> -oh /u01/app/crs/11.2.0.3/grid -localCase 5: Patching a Software Only GI Home Installation1.Apply the CRS patch using.As the GI home owner execute:$ <GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/13696242As the GI home owner execute:$ <GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/13923804Case 6: Patching a Software Only Oracle RAC or Oracle RAC One Node Home Installation1.Run the pre script for DB component of the patch.As the database home owner execute:$ <UNZIPPED_PATCH_LOCATION>/13696242/custom/server/13696242/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>2.Apply the DB patch.As the database home owner execute:$ <ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/13696242/custom/server/13696242$ <ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/139238043.Run the post script for DB component of the patch.As the database home owner execute:$ <UNZIPPED_PATCH_LOCATION>/13696242/custom/server/13696242/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>=================================================================================================================================@racpatchingAll-Node Patch--------------. Shutdown all Oracle instances on all nodes. Apply the patch to all nodes. Bring all nodes upMinimum downtime----------------. Shutdown the Oracle instance on node 1. Apply the patch to the Oracle instance on node 1. Shutdown the Oracle instance on node 2. Apply the patch to the Oracle instance on node 2. Shutdown the Oracle instance on node 3. At this point, instances on nodes 1 and 2 can be brought up. Apply the patch to the Oracle instance on node 3. Startup the Oracle instance on node 3 Rolling patch (no downtime) ---------------------------. Shutdown the Oracle instance on node 1. Apply the patch to the Oracle instance on node 1. Start the Oracle instance on node 1. Shutdown the Oracle instance on node 2. Apply the patch to the Oracle instance on node 2. Start the Oracle instance on node 2. Shutdown the Oracle instance on node 3. Apply the patch to the Oracle instance on node 3. Start the Oracle instance on node 3 ==========================================================================================================================================2.5.2 Loading Modified SQL Files into the DatabaseThe following steps load modified SQL files into the database. For an Oracle RAC or Oracle RAC One Node environment, perform these steps on only one node.1.For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql script as follows:cd $ORACLE_HOME/rdbms/adminsqlplus /nologSQL> CONNECT / AS SYSDBASQL> STARTUPSQL> @?/rdbms/admin/catbundle.sql psu applySQL> QUITThe catbundle.sql execution is reflected in the dba_registry_history view by a row associated with bundle series PSU.For information about the catbundle.sql script, see My Oracle Support Note 605795.1 Introduction to Oracle Database catbundle.sql.2.Check the following log files in $ORACLE_BASE/cfgtoollogs/catbundle for any errors:catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.logcatbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.logwhere TIMESTAMP is of the form YYYYMMMDD_HH_MM_SS. If there are errors, refer to Section 3, "Known Issues".2.5.3 Upgrade Oracle Recovery Manager CatalogIf you are using the Oracle Recovery Manager, the catalog needs to be upgraded. Enter the following command to upgrade it:$ rman catalog username/password@aliasRMAN> UPGRADE CATALOG;=====================================Eliminating Migrated or Chained Rows in a TableYou can use the information in the CHAINED_ROWS table to reduce or eliminate migrated and chained rows in an existing table. Use the following procedure.Use the ANALYZE statement to collect information about migrated and chained rows.ANALYZE TABLE order_hist LIST CHAINED ROWS;Query the output table:SELECT *FROM CHAINED_ROWSWHERE TABLE_NAME = 'ORDER_HIST';OWNER_NAME TABLE_NAME CLUST... HEAD_ROWID TIMESTAMP---------- ---------- -----... ------------------ ---------SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAA 04-MAR-96SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAB 04-MAR-96SCOTT ORDER_HIST ... AAAAluAAHAAAAA1AAC 04-MAR-96The output lists all rows that are either migrated or chained.If the output table shows that you have many migrated or chained rows, then you can eliminate migrated rows by continuing through the following steps:Create an intermediate table with the same columns as the existing table to hold the migrated and chained rows:CREATE TABLE int_order_histAS SELECT *FROM order_histWHERE ROWID IN(SELECT HEAD_ROWIDFROM CHAINED_ROWSWHERE TABLE_NAME = 'ORDER_HIST');Delete the migrated and chained rows from the existing table:DELETE FROM order_histWHERE ROWID IN(SELECT HEAD_ROWIDFROM CHAINED_ROWSWHERE TABLE_NAME = 'ORDER_HIST');Insert the rows of the intermediate table into the existing table:INSERT INTO order_histSELECT *FROM int_order_hist;Drop the intermediate table:DROP TABLE int_order_history;Delete the information collected in step 1 from the output table:DELETE FROM CHAINED_ROWSWHERE TABLE_NAME = 'ORDER_HIST';Use the ANALYZE statement again, and query the output table.======================================CREATE DISKGROUP TEST EXTERNAL REDUNDANCY DISK '/dev/oracleasm/disks/DG_TEST','/dev/oracleasm/disks/DG_TEST1','/dev/oracleasm/disks/DG_TEST2' ATTRIBUTE 'au_size'='4M','compatible.asm' = '11.2.0.3.0','compatible.rdbms' = '11.2.0.3.0','compatible.advm' = '11.2.0.3.0';CREATE DISKGROUP DATADG EXTERNAL REDUNDANCY DISK 'ORCL:ARGQ_DATA2','ORCL:ARGQ_DATA3','ORCL:ARGQ_DATA4','ORCL:ARGQ_DATA5','ORCL:ARGQ_DATA6','ORCL:ARGQ_DATA7','ORCL:ARGQ_DATA8','ORCL:ARGQ_DATA9','ORCL:ARGQ_DATA10';CREATE DISKGROUP UNDODG EXTERNAL REDUNDANCY DISK 'ORCL:ARGQ_UNDO1','ORCL:ARGQ_UNDO2','ORCL:ARGQ_UNDO3';CREATE DISKGROUP TEMPDG EXTERNAL REDUNDANCY DISK 'ORCL:ARGQ_DATA1','ORCL:ARGQ_DATA2','ORCL:ARGQ_TEMP3';CREATE DISKGROUP FRADG EXTERNAL REDUNDANCY DISK 'ORCL:ARGQ_FRA1','ORCL:ARGQ_FRA2','ORCL:ARGQ_FRA3','ORCL:ARGQ_FRA4','ORCL:ARGQ_FRA5','ORCL:ARGQ_FRA6';CREATE DISKGROUP REDODG1 EXTERNAL REDUNDANCY DISK 'ORCL:ARGQ_REDO_1';CREATE DISKGROUP REDODG2 EXTERNAL REDUNDANCY DISK 'ORCL:ARGQ_REDO_2';select name,state,total_mb,free_mb,COMPATIBILITY,DATABASE_COMPATIBILITY from gv$asm_diskgroup;alter diskgroup ARGQ_UNDO set attribute 'compatible.asm'='11.2';alter diskgroup ARGQ_UNDO set attribute 'compatible.rdbms'='11.2'; ==========================================set lines 160set pages 2002set time oncolumn machine format a20column event format a35column program format a30column schemaname for a10column action format a50column FC_cdt new_value file_time noprintcolumn FC_DB new_value file_DB noprintselect to_char(sysdate,'dd_mm_yyyy_hh24_mi_ss') FC_cdt from dual;select instance_name FC_DB from gv$instance;spool &file_DB._Session_Check_&file_time..txtprompt ===== TOTAL SESSION ======select count(*) from v$session;prompt ===== SESSION Count as per EVENT ======select event,count(*) from v$session group by event;prompt ===== TOTAL SESSION DETAIL INFORMATION======select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemaname,status from v$session where logon_time not like sysdate and schemaname not like 'SYS%'order by logon_time;spool off;exit;select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemaname,status from v$session where sid = &SID order by logon_time desc;select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemaname,status from v$session where event like '%gc%' order by logon_time desc;select snaps.begin_interval_time, snaps.instance_number,snaps.snap_id,hist.event_name , hist.wait_time_milli, hist.wait_count from dba_hist_event_histogram hist, dba_hist_snapshot snaps where snaps.snap_id = hist.snap_id and snaps.instance_number = hist.instance_number and snaps.begin_interval_time > sysdate - 1/12 -- sysdate - 1/12 -> display AWR reports from the last 2 hoursAND hist.event_name like lower ('%log%') order by 4,2,3;-- order by snaps.snap_id , snaps.instance_number, wait_time_milli;set lines 160set pages 2002set time oncolumn FC_cdt new_value file_time noprintcolumn FC_DB new_value file_DB noprintselect to_char(sysdate,'dd_mm_yyyy_hh24_mi_ss') FC_cdt from dual;select instance_name FC_DB from gv$instance;spool &file_DB._Session_Check_&file_time..txtspool off;exit;===================================================change archivelog all crosscheck;crosscheck backup of database; ====******** DAILY QUERY *********=====BLOCKING=========Recipie #1 - find blocking sessions with v$sessionSELECTs.blocking_session, s.sid, s.serial#, s.seconds_in_waitFROMv$session sWHEREblocking_session IS NOT NULL;Recipie #2 - find blocking sessions using v$lockSELECT l1.sid || ' is blocking ' || l2.sid blocking_sessionsFROM v$lock l1, v$lock l2WHEREl1.block = 1 ANDl2.request > 0 ANDl1.id1 = l2.id1 ANDl1.id2 = l2.id2;Recipie #3 - blocking sessions with all available informationThe next query prints a few more information, it let's you quickly see who's blocking who. Run this query and you can immediately call the colleague who's locking your tableSELECT s1.username || '@' || s1.machine|| ' ( SID=' || s1.sid || ' ) is blocking '|| s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_statusFROM v$lock l1, v$session s1, v$lock l2, v$session s2WHERE s1.sid=l1.sid AND s2.sid=l2.sidAND l1.BLOCK=1 AND l2.request > 0AND l1.id1 = l2.id1AND l2.id2 = l2.id2 ;==============================================================================================================SILENT INSTALLATIONYou can use the below command to run the silent mode and after installation finish, run root.sh with root privilegecd /backup/11203/database/response./runInstaller -silent -responseFile /u01/app/oracle/data/db/database/db_install_new.rsp==============================================================================================================@UPGRADATION to 11.2.0.3.8 PSU81. Install 11.2.0.3.0 Software -- 104045302. Database ( USUX52P5 ) upgrade to 11.2.0.3 on USHPEAVDBS016.Pre-Upgrade TASKS From OLD HOME...DBSQL> @$11g_ORACLE_HOME/rdbms/admin/utlu112i.sqlSQL> select * from registry$sys_inv_objs; -- Any invalid SYS/SYSTEM objects found before upgrading the database are stored in the table named registry$sys_inv_objsSQL> PURGE dba_recyclebinSQL> @utlrp.sqlSQL> Gather System StatisticsSQL> backup PFILE / SPFILEChange Compatible parameter to 11.2.0.3 Upgrade TASKSQL> STARTUP UPGRADE -- From New HOMESQL> @?/rdbms/admin/catupgrd.sqlSQL> @utlu112s.sql -- the Post-Upgrade Status Tool, which provides a summary of the upgrade at the end of the spool logSQL> @catuppst.sqlSQL> @utlrp.sqlSQL> SELECT count(*) FROM dba_invalid_objects;SQL> SELECT distinct object_name FROM dba_invalid_objects;•After the upgrade, run ORACLE_HOME/rdbms/admin/utluiobj.sql3. Apply PSU 8 Patch on 11.2.0.3.0 -- 16902043unzip p16902043_11203_<platform>.zipcd 16902043opatch prereq CheckConflictAgainstOHWithDetail -ph ./opatch applycd $ORACLE_HOME/rdbms/adminsqlplus /nologSQL> CONNECT / AS SYSDBASQL> STARTUPSQL> @catbundle.sql psu applyopatch lsinventory===POSSIBLE Errors ?ORA-00401: the value for parameter compatible is not supported by this releaseThe COMPATIBLE initialization parameter is set to a value less than 10.0.0.?ORA-39701: database must be mounted EXCLUSIVE for UPGRADE or DOWNGRADEThe CLUSTER_DATABASE initialization parameter is set to TRUE instead of FALSE.?ORA-39700: database must be opened with UPGRADE optionThe STARTUP command was issued without the UPGRADE keyword.?ORA-00336: log file size xxxx blocks is less than minimum 8192 blocksA redo log file size is less than 4 MB:===1. Install 11.2.0.3.0 rdbms software11.2.0.3 patch set is a full release. There is no need to install 11.2.0.1 softwareSee Note 1189783.1 Important Changes to Oracle Database Patch Sets Starting With 11.2.0.2 The software can be downloaded from My Oracle support: Patch:10404530Please select your platform before downloading (Click on "Platform or Language" drop down menu)if the platform name contains (32-bit) then it's 32-bit 11.2.0.3 client versionTo install 11.2.0.3, you must download both p10404530_112030_<platform>_1of7.zipand p10404530_112030_<platform>_2of7.zip<platform> = your platform( ie for linux x86, download p10404530_112030_LINUX_1of7.zip andp10404530_112030_LINUX_2of7.zip )Note 1194734.1 : Where do I find that on My Oracle Support (MOS) [Video]Note 549617.1 : How To Verify The Integrity Of A Patch/Software Download? [Video]Note 169706.1 : Oracle Database Installation and Configuration Requirements Quick Reference (8.0.5 to 11.2)The minimum version required to upgrade to 11.2.0.X.X is 9.2.0.8.0.Note 551141.1 : Database Server Upgrade/Downgrade Compatibility Matrix2. Upgrade the database to 11.2.0.3.0Note 419550.1 : Different Upgrade Methods For Upgrading Your DatabaseNote 837570.1 : Complete Checklist for Manual Upgrades to 11gR2Note 870814.1 : Complete checklist to upgrade the database to 11gR2 using DBUAREFERENCE:Availability and Known issues for 11.2.0.3 Note:1348336.111.2.0.3 Patch Set - List of Bug Fixes by Problem Type Note 1348303.1Actions For DST Updates When Upgrading To Or Applying The 11.2.0.3 Patchset Note 1358166.1==============================================================================================================@postupgSELECT comp_name component, version, status FROM dba_registry;http://dbaoracletips.blogspot.in/2014/02/owb-component-not-upgraded-to-11204.htmlThe Database has been upgraded from 11.2.0.2 to 11.2.0.4. Upgrade completed successfully but the OWB component is not upgraded and showing version 11.2.0.4Solution:Login as sysdba and execute below scripts execute the script $ORACLE_HOME\owb\UnifiedRepos\clean_owbsys.sqlexecute the script $ORACLE_HOME\owb\UnifiedRepos\cat_owb.sql================================================================================================================== RMAN Arch Deleterman target / nocatalog << EOF >> $RMAN_LOGrun{allocate channel dsk_inst1 device type disk;allocate channel dsk_inst2 device type disk;delete noprompt archivelog all completed before 'sysdate -2';release channel dsk_inst1;release channel dsk_inst2;}EOFlist archivelog until time 'sysdate - 1';crosscheck archivelog until time 'sysdate - 1';delete noprompt archivelog all completed before 'sysdate - 1';delete noprompt archivelog all completed before 'sysdate - 2';delete noprompt archivelog all completed before 'sysdate - 1/12';delete noprompt archivelog from sequence 1111 to sequence 1122;rman target / nocatalog << EOF >> $RMAN_LOGrun{allocate channel dsk_inst1 device type disk;allocate channel dsk_inst2 device type disk;--delete noprompt archivelog all completed before 'sysdate -2';backup database;release channel dsk_inst1;release channel dsk_inst2;}EOFRMAN> BACKUP ARCHIVELOG FROM SEQUENCE 73320 UNTIL SEQUENCE 73500;RMAN> DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 73500;DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 267914;DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 268265;DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 1100;DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 1370;list backup of datafile 1,2,3,4 completed after 'trunc(sysdate) -3';list backup summary completed after 'trunc(sysdate) -3';==========================================================================================================RMAN Restore on Time basis:RMAN> run{Set until time "to_date('15/04/2014 00:30:00','dd/mm/yyyy hh24:mi:ss')";Restore controlfile from ‘h:\rman\backup…..\control.ctl’;}RMAN> restore database until time "to_date('15/04/2014 00:30:00','dd/mm/yyyy hh24:mi:ss')";RMAN> recover database until time "to_date('15/04/2014 00:30:00','dd/mm/yyyy hh24:mi:ss')";SQL> alter database open resetlogs;======configure retention policy to recovery window of 7 days;configure retention policy to redundancy 2;==========================================================================================================root@HBFCRPPRDDB1:/fc_precut_dump/scripts $cat fc_precut_rman.sh #!/usr/bin/ksh# Name : rman_bkp.sh# Description :# This script takes a RMAN Daily FULL Database and Archive files backup.# Also takes controlfile and spfile autobackup.# It removes the obsolete backup and 3 days old archive files.cd /fc_precut_dump/backup/logs#topas_nmon -f -t -s10 -c180export ORACLE_HOME=/oracle11R2/app/11.2.2export ORACLE_SID=FCPRECUTexport PATH=$ORACLE_HOME/bin:$PATHtdate=`date '+%d-%m-%y'`DBNAME=FCPRECUTBKPLOC=/fc_precut_dump/backup/RMAN/CURRENTLOGLOC=/fc_precut_dump/backup/logs/RMANRMAN_LOG=$LOGLOC/"$DBNAME"_rman_backup_$tdate.logsqlplus " /as sysdba" <<EOF>/fc_precut_dump/backup/logs/database_status.lst@/fc_precut_dump/scripts/sql/database_status.sqlEOFa=`cat /fc_precut_dump/backup/logs/database_status.lst | grep -i STARTED | wc -l | awk '{print $1}'`if [ $a -eq 1 ]thenecho "fcpreeod database is in nomount mode...please connect dba support"exit 1elseecho " ......"fidbavl=`ps -eaf|grep ora_pmon_FCPRECUT | grep -v grep | wc -l`spchk=`df -gt /fc_precut_dump|awk '{print $5}'|tail -1|cut -f1|sed -e 's/%//'`if [ $dbavl -eq 1 ] && [ $spchk -le 85 ]; thenecho "\n\n **************** RMAN Backup Startup time : `date` *****************" >> $RMAN_LOGrman target / nocatalog << EOF >> $RMAN_LOGrun{allocate channel c1 type disk;allocate channel c2 type disk;allocate channel c3 type disk;allocate channel c4 type disk;allocate channel c5 type disk;allocate channel c6 type disk;allocate channel c7 type disk;allocate channel c8 type disk;allocate channel c9 type disk;allocate channel c10 type disk;allocate channel c11 type disk;allocate channel c12 type disk;allocate channel c13 type disk;allocate channel c14 type disk;allocate channel c15 type disk;allocate channel c16 type disk;allocate channel c17 type disk;allocate channel c18 type disk;allocate channel c19 type disk;allocate channel c20 type disk;CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/fc_precut_dump/backup/RMAN/CURRENT/snapcf_FCRPT.f';CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/fc_precut_dump/backup/RMAN/CURRENT/fcprdgl_ctl%F';crosscheck backup;backup as compressed backupset database TAG 'Daily_Full_DB_Backup_$tdate' FORMAT '$BKPLOC/DBFULL_FC_%U_%D_%M_%Y';backup archivelog all not backed up 1 times TAG 'ARC_Backup_$tdate' FORMAT '$BKPLOC/ARCH_FC_%U_%D_%M_%Y';delete noprompt obsolete;release channel c1;release channel c2;release channel c3;release channel c4;release channel c5;release channel c6;release channel c7;release channel c8;release channel c9;release channel c10;release channel c11;release channel c12;release channel c13;release channel c14;release channel c15;release channel c16;release channel c17;release channel c18;release channel c19;release channel c20;}EOFelseecho "Database is down ...or Enough free space not available for Backup"exit 1ficd /openview_archive/openview_EXPBKPdt=`date +%d%m%Y_%H%M%S`find . -name "*.trc" -mtime +20 -exec rm {} \;00 23 27 * * /home/oracle/rr/EXPDP_openview.sh 2>> /home/oracle/rr/EXPDP_openview.errArun RBI - 9870054897Sonu Gupta - Mail Initiatedcd $BKPLOCfind . -name -mtime +60 -exec rm {} \;find . -mtime +20 -exec rm -rf {} \;find . -name "*.log" -mtime +60 -exec rm {} \;find . -mtime +1 -exec rm {} \;find . -mtime +20 -exec ls -ltr {} \;find . -mtime +10 -exec rm {} \;find . -mtime +1 -exec ls -ltr {} \;find . -mtime +0 -exec ls -ltr {} \;find . -mtime +1 -exec gzip {} \;find . -mtime +10 -exec rm {} \;find . -mtime -2 -exec rm {} \;find . -mtime -2 -exec ls -ltr {} \;find . -mtime +2 -exec ls -ltr {} \;Will ls Files whose Modified time is Older then 24 Hoursfind . -mtime +1 -name "*.gz" -exec ls -ltr {} \;Will ls Files whose Modified time is Older then 48 Hoursfind . -mtime +2 -exec ls -ltr {} \;echo "\n\n ******************RMAN Backup for $DBNAME has completed at : `date` **********************" >> $RMAN_LOGcd /fc_precut_dump/backup/logs/RMANchmod 755 $RMAN_LOGfind . -mtime +5 -exec rm {} \;exitZUS-EMTOOLS-MR-AR <ZUS-EMTOOLS-MR-AR@hp.com>find ./metap3_ora*.trc.gz -mtime +15 -exec rm {} \;find . -mtime +15 -exec ls -ltr {} \;find . -mtime +15 -exec gzip {} \;find . -mtime +30 -exec rm {} \;find . -mtime +1 -exec rm {} \;find . -mtime -1 -exec ls -ltr {} \;find . -mtime +200 -exec rm {} \;find ./metaemp1_ora_*.trc -mtime +3 -exec ls -ltr {} \;find /b001/backup/exports/wuktst -mtime +1 -exec ls -ltr {} \;find /b001/backup/exports/wukdev/ -mtime +1 -exec ls -ltr {} \;======= SQLSELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')124.30.56.17 - DELL 285010.240.32.201 - DELL 2850exec sp_send_cdosysmail 'dba@hdfcinsurance.com','dba@hdfcinsurance.com','','test','test'-2147023782.qazwsxed04======= Oracleopatch lsinventory -- check what this command does.select owner,object_name,object_type,created,status from dba_objects where object_NAME like '%KGSKWT%';select OWNER,CONSTRAINT_NAME,R_CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME,STATUS,INVALID from dba_constraints where TABLE_NAME like '%AUDIT_TRAIL%';select * from dba_cons_columns where CONSTRAINT_name like '%PRL_CANDIDATE_CASE_REGN_R88%';select OWNER,CONSTRAINT_NAME,R_CONSTRAINT_NAME,CONSTRAINT_TYPE,TABLE_NAME,STATUS,INVALID from dba_constraints where TABLE_NAME like '%PRL_CANDIDATE_CASE_REGN%';select owner,object_name,object_type,created,status from dba_objects where object_NAME like '%TTFGLD106954%';alter table Truncating & Deallocating space.================================SQL> TRUNCATE TABLE BIGTABLE REUSE STORAGE;SQL> ALTER TABLE BIGTABLE DEALLOCATE UNUSED KEEP 1707M; (2Gb*5/6) \\bkchome\Common\Others\Komal\sutapa\RPT-Setupimp ams/ams file='' log='' tables=(AMS_NEFT_COMMDETAILS,AMS_NEFT_DETAILS,CC_MED_LETTER_PDF,AMS_COMM_CHQ_DIS_STATUS,AMS_ECS_COMMDETAILS,AMS_ECS_MANREJ_DETAILS,AMS_NEFT_MANREJ_DETAILS) feedback=10000 buffer=1234567890 ignore=y('AMS_NEFT_COMMDETAILS','AMS_NEFT_DETAILS','CC_MED_LETTER_PDF','AMS_COMM_CHQ_DIS_STATUS','AMS_ECS_COMMDETAILS','AMS_ECS_MANREJ_DETAILS','AMS_NEFT_MANREJ_DETAILS')=====================================================================================vi rmanbackup.shexport ORACLE_HOME=/oracle11R2/app/11.2.2export ORACLE_SID=FCPRECUTexport PATH=$ORACLE_HOME/bin:$PATHtdate=`date '+%d-%m-%y'`DBNAME=FCPRECUTRMAN_LOG=/home/oracle/$DBNAME_rmanbackup_$tdate.logrman target / nocatalog << EOF >> $RMAN_LOGrun{allocate channel dsk_inst1 device type disk;allocate channel dsk_inst2 device type disk;--delete noprompt archivelog all completed before 'sysdate -2';backup database;release channel dsk_inst1;release channel dsk_inst2;}EOFdelete archivelog all backedup before 'sysdate';RAC Services Check Oracle11g==========srvctl config database -d RACsrvctl status database -d HDFCPRODsrvctl stop database -d RACsrvctl start instance -d racdb -i racdb1, racdb3srvctl stop instance -d racdb -i racdb1, racdb3srvctl statuscrsctl status resource -tcrsctl status server -fSELECT * FROM v$active_instances;SELECT svrname, dirname FROM v$dnfs_servers;ORACLE10g==========C:\>crsctl check crsCSS appears healthyCRS appears healthyEVM appears healthyD:\oracle\product\10.2.0\crs\BIN>srvctl status nodeapps -n ccdb1VIP is running on node: ccdb1GSD is running on node: ccdb1Listener is not running on node: ccdb1ONS daemon is running on node: ccdb1crs_stat -tC:\Documents and Settings\setouqe>D:\oracle\product\10.2.0\crs\BIN\crs_stat.exe -tName Type Target State Host------------------------------------------------------------ora....T1.inst application ONLINE OFFLINEora....T2.inst application ONLINE ONLINE ccdb2ora.HDFCUAT.db application ONLINE ONLINE ccdb2ora....AT1.srv application ONLINE ONLINE ccdb2ora....luat.cs application ONLINE ONLINE ccdb2ora....SM1.asm application ONLINE ONLINE ccdb1ora....B1.lsnr application ONLINE OFFLINEora.ccdb1.gsd application ONLINE OFFLINEora.ccdb1.ons application ONLINE ONLINE ccdb1ora.ccdb1.vip application ONLINE ONLINE ccdb1ora....SM2.asm application ONLINE ONLINE ccdb2ora....B2.lsnr application ONLINE ONLINE ccdb2ora.ccdb2.gsd application ONLINE ONLINE ccdb2ora.ccdb2.ons application ONLINE ONLINE ccdb2ora.ccdb2.vip application ONLINE ONLINE ccdb2ora....prod.db application OFFLINE OFFLINEora....d1.inst application ONLINE OFFLINEora....d2.inst application ONLINE UNKNOWN ccdb2ora....prod.cs application OFFLINE OFFLINEora....od1.srv application OFFLINE OFFLINEora....od2.srv application OFFLINE OFFLINE=============================================================================Supriyo - 9920057626Daily TBSP Check:=============10.60.0.186 -- ODS - Auto Manu10.60.0.141 -- PRLPROD10.60.0.144 -- Not Required10.60.1.91 -- MINT1 , PINNACLE1 -- OracleDBConsole Auto10.60.1.93 -- MINT2 , PINNACLE2 -- OracleDBConsole Auto124.30.56.2 -- HDFCPROD1124.30.56.15 -- HDFCPROD210.60.0.201 -- HDFCDB , IDB , FNTIDBCS -- Manu10.60.1.208 -- MDEALING -- Auto - Manu10.60.0.230 -- HDFCAML , FNTIDBCS , AMLUAT -- Manu10.60.0.127 -- 10.60.0.195 -- SUNAR , SUNLA , ORACLE9 Agent -- Auto ManuDaily Disk Space Check:=======================10.60.0.126 -- Standby Server10.60.0.201124.30.56.16 -- Standby ServerDaily ASM Check:================124.30.56.2 / 1510.60.1.91 / 93select * from v$sess_io where sid in (select sid from v$session where program like '%(J0%');@schemasize:select sum(bytes/1024/1024/1024) from dba_segments where owner = '&AMS';select username,default_tablespace from dba_users where username = 'AMS';EVENTS :=========cursor: pin S wait on X : A session waits on this event when requesting a mutex for sharable operations related to pins (such as executing a cursor), but the mutex cannot be granted because it is being held exclusively by another session (which is most likely parsing the cursor). SELECT p2raw ,to_number(substr(to_char(rawtohex(p2raw)), 1, 8), 'XXXXXXXX') sid FROM v$session WHERE event = 'cursor: pin S wait on X'; P2RAW SID ---------------- --- 0000001F00000000 31 On 64 bit platforms 8 bytes are used, so the top 4 bytes are the holding session Id (if the mutex is held X), and the bottom 4 bytes are the ref count (if the mutex is held S). On 32 bit platforms 4 bytes are used, so the top 2 bytes are the holding session Id (if the mutex is held X) and the bottom 2 bytes are the ref count (if the mutex is held S).select p1, p2raw, count(*) from v$session where event = 'cursor: pin S wait on X’ and wait_time = 0 group by p1, p2raw; col p1text for a15col p2text for a15col p3text for a15select sid,serial#,program,event,p1, p1text ,p2, p2text,p3,p3text, p2raw from v$session where event like '%write%';SOLUTION:---------Quick workaround is to set "_kks_use_mutex_pin" to false . or Apply the patch 5907779 RMAN: Restoring an RMAN Backup to Another Node [ID 73974.1]library cache pinlibrary cache lockALTER DATABASE ADD LOGFILE group 7 ('/u02/oradata/P38/redo07a.log', '/u03/oradata/P38/redo07b.log') size 15728640;ed cursorcheckselect a.value, s.username, s.sid, s.serial#from v$sesstat a, v$statname b, v$session swhere a.statistic# = b.statistic# and s.sid=a.sidand b.name = 'opened cursors current'order by 1;select sum(x.value) from (select a.value, s.username, s.sid, s.serial#from v$sesstat a, v$statname b, v$session swhere a.statistic# = b.statistic# and s.sid=a.sidand b.name = 'opened cursors current') x;col max_open_cur for a7select max(a.value) as highest_open_cur, p.value as max_open_curfrom v$sesstat a, v$statname b, v$parameter pwhere a.statistic# = b.statistic# and b.name = 'opened cursors current'and p.name= 'open_cursors'group by p.value;=============================Freespace:set time oncolumn host_name format a25select name,open_mode from gv$database;select instance_name,host_name,status,logins from gv$instance;set pages 500set lines 120set heading oncolumn tablespace_name for a30column tbsize for 999999999.999column tbfree for 999999999.999column Largest for 99999.999column ratio for 9999.99column Required for 99999.999selecta.tablespace_name ,tbsize ,tbfree ,b.tbfree/a.tbsize*100 "% Free TBS" ,b.Largest "Largest space"from( select tablespace_name,sum(bytes)/1024/1024 tbsizefrom dba_data_filesgroup by tablespace_name) a,( select tablespace_name,nvl(sum(bytes)/1024/1024,0) tbfree,nvl(max(bytes)/1024/1024,0) Largestfrom dba_free_spacegroup by tablespace_name) bwhere a.tablespace_name = b.tablespace_name(+)order by 4 desc;D:\IBM Oracle Docs\IBM\RBI_Requirements\Mail from Maruti CMDDB\CDBMSNEW_Tables_Detailsselect owner,segment_name Table_Name ,sum(bytes/1024/1024) Table_MB from dba_segments where segment_type = 'TABLE' and TABLESPACE_NAME not like 'SYS%' group by owner,segment_name order by 1,3;select * from v$recover_file;select distinct status from v$datafile;archive log list;alter system checkpoint;alter system switch logfile;07738900976column file_name format a55column tablespace_name format a22set pages 200set lines 200select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%&UNDO%' order by 3; select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files;select 'alter tablespace ' || tablespace_name || ' add datafile ' || ''' || '/CDBMS_DATA/cdbmsstg/oradata/cdbms_st/' || tablespace_name || '_C001.dbf' || ''' || ' size 1G autoextend on;' from dba_tablespaces order by 1;select sid,serial#,program,event ,to_char(logon_time,'DD-MM-YYYY HH24:MI:SS') from gv$session where schemaname not like 'SYS';select * from dba_tab_privs where grantee = 'MLOG$_VI_CHANNEL_T';select * from dba_tab_privs where grantee = 'OERR';@logon:------set lines 190select sid,serial#,program ,to_char(logon_time,'DD-MM-YYYY HH24:MI:SS'),SQL_HASH_VALUE,username,sql_id from gv$session where schemaname not like 'SYS' and status='ACTIVE' order by logon_time;======================set lines 180col username for a20col machine for a25col module for a45col sql_id for a20select count(*),username,sql_id,status,osuser,machine,module from v$session group by username,status,osuser,machine,module,sql_id order by 3;==============select sid,serial#,program ,to_char(logon_time,'DD-MM-YYYY HH24:MI:SS'),SQL_HASH_VALUE,sql_id from gv$session where sql_id is not null;select sid,serial#,program ,to_char(logon_time,'DD-MM-YYYY HH24:MI:SS'),SQL_HASH_VALUE,sql_id from gv$session where sid=183;Abhi. 9766673333Riyaz FreeSpace:=================set pages 999col tablespace_name format a40col "size MB" format 999,999,999col "free MB" format 99,999,999col "% Used" format 999select tsu.tablespace_name, ceil(tsu.used_mb) "size MB", decode(ceil(tsf.free_mb), NULL,0,ceil(tsf.free_mb)) "free MB", decode(100 - ceil(tsf.free_mb/tsu.used_mb*100), NULL, 100,100 - ceil(tsf.free_mb/tsu.used_mb*100)) "% used"from (select tablespace_name, sum(bytes)/1024/1024 used_mbfrom dba_data_files group by tablespace_name union allselect tablespace_name || ' **TEMP**', sum(bytes)/1024/1024 used_mbfrom dba_temp_files group by tablespace_name) tsu, (select tablespace_name, sum(bytes)/1024/1024 free_mbfrom dba_free_space group by tablespace_name) tsfwhere tsu.tablespace_name = tsf.tablespace_name (+)AND tsu.tablespace_name like '%TEMP%'order by 4;--AND tsu.tablespace_name like '%&TBS_NAME%'prompt ======================Checking Datafiles of TABLESPACE=================================================Yogesh / Farhad - 9921795572Jaianand harik. - 9820237054column file_name format a55column tablepsace_name format a22set pages 200set lines 200select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%&UNDO%' order by 3; select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files;select count(file_id) from dba_data_files where tablespace_name like '%&TBS%';column file_name format a55column tablepsace_name format a22set pages 200set lines 200select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where file_name like '%&UNDO%' order by 3; column file_name format a55column tablepsace_name format a22set pages 200set lines 200select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where autoextensible='YES' order by 6; column file_name format a65column tablepsace_name format a22set pages 200set lines 200select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where file_name like '%&UNDO%' order by 3; alter system set session_cached_cursors=150 scope=both sid='FBAU3FCR2';srvctl relocate service -d fcprdfcr -s fcprodnode2 -i FBAU3FCR2 -t FBAU3FCR1column file_name format a65column tablepsace_name format a22set pages 200set lines 160select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where file_name like '%&FIleName%' order by 2; select * from v$sort_usage -- No rows should be there to resize temp Tablespaceselect * from v$undostat -- to Check UNDO Tablespaceselect tablespace_name,count(file_name),sum(bytes/1024/1024) from dba_data_files group by tablespace_name order by 2;select distinct tablespace_name,status,file_id,bytes,blocks,owner from DBA_UNDO_EXTENTS where status='UNEXPIRED' order by 1,3;select file_id,tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%SYSTEM%';== Check Possible Shrinkcolumn file_name format a65column tablepsace_name format a22set pages 200set lines 160select file_id,tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%&Ams%' order by 1;select file_id,max((block_id+blocks-1)*8192)/1024/1024 from dba_extents where TABLESPACE_NAME like '%&AMS_MASTER%' group by file_id order by 1; column file_name format a65column tablepsace_name format a22set pages 200set lines 160select file_id,tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where file_name like '%&AMS_MASTER%' order by 1;select file_id,max((block_id+blocks-1)*8192)/1024/1024 from dba_extents where file_name like '%&AMS_MASTER%' group by file_id order by 1; col segment_name for a30set pages 200set lines 200select segment_name,file_id,sum(bytes/1024) from dba_extents where file_id = 43 group by segment_name,file_id;set linesize 150column file_name format a50column tablespace_name format a10column free_space format 9999.9999select ddf.file_name,ddf.tablespace_name,sum(dfs.bytes)/1024/1024 free_spacefrom dba_data_files ddf, dba_free_space dfswhere ddf.file_id = dfs.file_idand ddf.tablespace_name like 'MP1_DATA'group by ddf.file_name,ddf.tablespace_name;ALTER TABLE AUD$ DEALLOCATE UNUSED KEEP 500M;@tempfile:RESIZE :ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' RESIZE 18M;============SHRINK :ALTER TABLESPACE temp SHRINK SPACE KEEP 20M;ALTER TABLESPACE temp SHRINK TEMPFILE '+FRA/hdfcuat/tempfile/temp.507.721312809';=========================================DROP Single Tempfile :ALTER DATABASE TEMPFILE '/u02/oracle/data/lmtemp02.dbf' DROP INCLUDING DATAFILES;===========================================ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp_grp;===================================col file_name for a45select tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files order by file_name;=========================col TABLESPACE for a10col FILENAME for a50set lines 190SELECT d.tablespace_name tablespace , d.file_name filename, d.file_id fl_id, d.bytes/1024/1024size_m, NVL(t.bytes_cached/1024/1024, 0) used_m, TRUNC((t.bytes_cached / d.bytes) * 100) pct_usedFROMsys.dba_temp_files d, v$temp_extent_pool t, v$tempfile vWHERE (t.file_id (+)= d.file_id)AND (d.file_id = v.file#);==================================alter tablespace temp add tempfile '&tempfilepath' size 1800M;========================================================= Check Posible UNDO Shrink.column file_name format a65column tablepsace_name format a22set pages 200set lines 160select file_id,tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%&UNDO%' order by 3;select file_id,max((block_id+blocks-1)*8192)/1024/1024 from dba_extents where TABLESPACE_NAME like '%&UNDO%' group by file_id order by 1; =============================================select object_type,count(object_type) from dba_objects where owner = 'SAM_SIT' group by rollup(object_type);select sid,serial#,program,action,event from v$session where program like '%imp%';select count(*) from dba_indexes where owner = 'SAM_SIT';select object_name,owner,object_type,status from dba_objects where object_id=307196;=============================================set pages 200set lines 200column machine format a18column event format a35column program format a33column schemaname for a10column username for a10column action format a50col LT for a21select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,schemaname,username,status from v$session where logon_time like sysdate and schemaname <> 'SYS' order by logon_time desc;select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,schemaname,status from v$session where logon_time not like sysdate and schemaname <> 'SYS' order by logon_time;col sidd for a55select 'alter system kill session ''' || sid || ',' || serial# || ''' immediate;' SIDD --, Program from v$session where to_char(logon_time,'dd-mm-yyyy hh24') like '01-08-2014 21' and schemaname <> 'SYS' and program like 'JDBC%';and lower(program) like 'plsqldev.exe' order by logon_time;col sidd for a55col LT for a22col program for a30col schemaname for a12col osuser for a10select 'alter system kill session ''' || sid || ',' || serial# || ''' immediate;' SIDD, to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,program,osuser, schemaname from v$session where logon_time < sysdate - 1 and schemaname <> 'SYS' order by logon_time;col osuser for a10select 'alter system kill session ''' || sid || ',' || serial# || ''' immediate;' SIDD, to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,program,osuser,status from v$session where osuser in ('bzp8xz', 'bz3l0j','bzztqb') order by 2;--where sid=&SID;select * from v$sess_io where sid in (select sid from v$session where program like '%(J0%');select sid,serial#,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,schemaname,status from v$session order by logon_time;col program for a30select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemaname from v$session order by logon_time;@session:set pages 200set lines 200column machine format a20column event format a35column program format a30column schemaname for a10column action format a50select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemaname,status from v$session where schemaname not like 'SYS%' order by logon_time;set pages 200set lines 200column machine format a20column event format a35column program format a20column action format a20column schemaname format a5select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemaname,action from v$session where sid in (select distinct sid fromv$statname n,v$sesstat swhere n.STATISTIC# = s.STATISTIC# and name like 'session%memory%');col LT for a35select sid,serial#,machine,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,schemaname from v$session order by logon_time;select spid, osuser, s.program fromv$process p, v$session s where p.addr=s.paddrand id=&sid;select sid,s.serial#, spid, osuser, s.program fromv$process p, v$session s where p.addr=s.paddrand spid=&spid;-- Enable row movement.ALTER TABLE FLAG.FLAG_EMP_CFC_DETAIL ENABLE ROW MOVEMENT;-- Recover space and amend the high water mark (HWM).ALTER TABLE FLAG.FLAG_EMP_CFC_DETAIL SHRINK SPACE;--- For UNDO== Check Possible Shrinkcolumn file_name format a65column tablepsace_name format a22set pages 200set lines 160select file_id,tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%UNDO%' order by 1;select file_id,max((block_id+blocks-1)*8192)/1024/1024 from dba_extents where TABLESPACE_NAME like '%UNDO%' group by file_id order by 1; SELECT to_char(stat.begin_time,'dd-mm-yyyy hh24:mi:ss'),to_char(stat.end_time,'dd-mm-yyyy hh24:mi:ss'),stat.undoblks * param.value / 1024 / 1024 undo_mb,stat.undoblks * param.value / 1024 / 1024 / 10 / 60undo_mb_per_sec,stat.maxquerylenFROM v$undostat stat,v$parameter paramWHERE param.name = 'db_block_size';ROLLBACKselect activeblks,UNEXPIREDBLKS,EXPIREDBLKS,TUNED_UNDORETENTION from v$undostat;select distinct tablespace_name,status,file_id,bytes,blocks,owner from DBA_UNDO_EXTENTS where status<>'EXPIRED' order by 1;select latch ,shrinks,extends,status,curext,curblk from V$ROLLSTAT where rownum <= 10;SELECT TO_CHAR(BEGIN_TIME, 'MM/DD/YYYY HH24:MI:SS') BEGIN_TIME,TO_CHAR(END_TIME, 'MM/DD/YYYY HH24:MI:SS') END_TIME,UNDOTSN, UNDOBLKS, TXNCOUNT, MAXCONCURRENCY AS "MAXCON"FROM v$UNDOSTAT WHERE rownum <= 144;select tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%&TBSP%';create tablespace TBS_PRL_PROD1_INDX datafile '' size 2G;@which Session is Using UNDO Tablespace ==============col osuser for a15col user for a10col undo_tbs for a12col SEGMENT_NM for a15set pages 200set lines 200SELECT ds.TABLESPACE_NAME "UNDO_TBS",ds.RELATIVE_FNO "File Nos",r.name "SEGMENT_NM", s.sid, s.serial#,s.osuser, s.username "USER", t.status,t.cr_get, t.phy_io, t.used_ublk, t.noundo,substr(s.program, 1, 78) "COMMAND"FROM sys.v_$session s, sys.v_$transaction t, sys.v_$rollname r,dba_segments dsWHERE t.addr = s.taddrand t.xidusn = r.usnand ds.segment_name = r.name(+)ORDER BY t.cr_get, t.phy_io;SELECT r.name "RBS", s.sid, s.serial#,s.osuser, s.username "USER", t.status,t.cr_get, t.phy_io, t.used_ublk, t.noundo,substr(s.program, 1, 78) "COMMAND"FROM sys.v_$session s, sys.v_$transaction t, sys.v_$rollname rWHERE t.addr = s.taddrand t.xidusn = r.usnORDER BY t.cr_get, t.phy_io;arun.k74@wipro.comselect distinct tablespace_name,status,file_id,bytes,blocks,owner from DBA_UNDO_EXTENTS where status<>'EXPIRED' order by 1;col program for a30col event for a40col action for a30col username for a10col schemaname for a5select sid,serial#,program,event,action,schemaname,username from v$session where sid=;==============================CREATE PROFILE my_profile LIMITFAILED_LOGIN_ATTEMPTS 3 -- Account locked after 3 failed logins.PASSWORD_LOCK_TIME 5 -- Number of days account is locked for. UNLIMITED required explicit unlock by DBA.PASSWORD_LIFE_TIME 30 -- Password expires after 90 days.PASSWORD_GRACE_TIME 3 -- Grace period for password expiration.PASSWORD_REUSE_TIME 120 -- Number of days until a specific password can be reused. UNLIMITED means never.PASSWORD_REUSE_MAX 10 -- The number of changes required before a password can be reused. UNLIMITED means never./ALTER USER scott PROFILE my_profile;alter profile DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;==============================Adviseselect distinct task_id,BENEFIT_TYPE from dba_advisor_recommendations where BENEFIT_TYPE like 'Enable%' order by BENEFIT_TYPE;SELECTr.type,r.Rank,r.benefit,f.impact_type,f.impact,f.messageFROMdba_advisor_recommendations r,dba_advisor_findings fWHERE r.task_name = 'TASK_4502'AND r.finding_id = f.finding_idAND r.task_id = f.task_idORDER BY r.rank ASC, r.benefit DESC;===============alter system set standby_file_management='manual';alter database create datafile 'D:\ORACLE\PRODUCT\10.2.0\DB_2\DATABASE\UNNAMED00196' as 'D:\ORACLE\PRODUCT\10.2.0\DB_2\DATABASE\ams_transaction_data.317.718326941' STEP1:- Check the name of the datafile on standby databaseselect name from v$datafile; ---- This command should show the datafile name as UNNAMEDxxxxxSTEP2:- ON STANDBY DATABASE alter system set standby_file_management='manual';STEP3:- Rename the datafilealter database create datafile 'C:\ORACLE\ORA10G\DATABASE\UNNAMED00129' as 'C:\ORACLE\ORA10G\DATABASE\actual_dbfile_name.dbf'STEP4:- On the standby database alter system set standby_file_management='auto'; STEP5:- On the standby databaserecover managed standby database disconnect;shutdown and then reopen the standby database and continue applying the redo logs SQL> show parameter standNAME TYPE VALUE------------------------------------ ----------- ------------------------------standby_archive_dest string %ORACLE_HOME%\RDBMSstandby_file_management string AUTOSQL>547 - 2== If alter database create datafile 'OLD File' as 'NEW File'; Doesnot workSQL> alter system set standby_file_management='AUTO'; -- Parameter status need to be checkedRMAN> run {2> set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00012' to '+DATA_IDEAS/pinnacle/datafile/ideas.318.719999863';3> restore datafile 12;4> recover datafile 12;5> }alter database create datafile 'D:\APP\ORACLE\PRODUCT\11.2.0\DBHOME_1\DATABASE\UNNAMED00005' as 'D:\APP\ORACLE\ORADATA\ORCL\DBSP101.DBF';select thread#,sequence#,to_char(first_time,'DD-MON-YYYY HH24:MI:SS') from v$log_history where sequence# in (select max(sequence#) from v$log_history group by thread#);select thread#,sequence#,to_char(first_time,'DD-MON-YYYY HH24:MI:SS') from v$log_history where sequence# = 567;delete archivelog all completed before 'sysdate -1';select thread#,sequence#,to_char(first_time,'DD-MON-YYYY HH24:MI:SS') from v$log_history where sequence# = 3196;RIYAZ STANDBY APPLIED APPLY LOG DETAILS1. Please fire the sql first to determine which archive last came last and which was the last applied. Server standby 008 select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied" from (select thread# thrd, max(sequence#) almax from v$archived_log where resetlogs_change#=(select resetlogs_change# from v$database) group by thread#) al, (select thread# thrd, max(sequence#) lhmax from v$log_history where resetlogs_change#=(select resetlogs_change# from v$database) group by thread#) lh where al.thrd = lh.thrd;2. Check the archive gap.SELECT PROCESS, STATUS,SEQUENCE#,BLOCK#,BLOCKS, DELAY_MINS FROM V$MANAGED_STANDBY;select thread#,sequence#,to_char(first_time,'DD-MON-YYYY HH24:MI:SS') from v$log_history where to_char(first_time,'DD-MON-YY') >= '11-MAY-14' and to_char(first_time,'DD-MON-YY') <= '11-MAY-14';alter database create standby controlfile as '/b01/backup/STANDBY_CTL.ctl';alter database backup controlfile to trace;alter database backup controlfile to 'g:\Controlfile.ctl';alter database backup controlfile to '/home/ais/oradw/rr/control_SP1.ctl';SCN RMAN RESTORE -- If Standby ARCHIVE Files are Missing=========================================================1....On Primary & Standby Database.SQL> select name,open_mode,CURRENT_SCN from v$database;SQL> select scn_to_timestamp(1447102) from dual; ---- e.g SCN NOS.2....On Primary Database. ( a OR b OR c) ----- Take SCN Nos. from v$database (as above)a. RMAN> BACKUP DEVICE TYPE SBT INCREMENTAL FROM SCN 750923 DATABASE;b. RMAN> BACKUP INCREMENTAL FROM SCN 750923 DATABASE;c. RMAN> BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE FORMAT '/tmp/incr_standby_%U';3....On Primary Database.Backup ControlfileSQL> alter database create standby controlfile as 'BACKUP LOCATION\STANDBY_CTL.ctl';4.... COPY Backedup FILES to Standby DB Server.5.... On Standby Database.SQL> shut immediate.SQL> startup nomountRMAN> restore controlfile from 'CTL FILE SAVED LOCATION\Control.ctl';SQL> alter database mount standby database;SQL> alter system set standby_Management parameter to MANUAL6....On Standby Database$ rman target=/RMAN> catalog start with '<BACKUP FILE STORED LOCATION>';7....On Standby Database.START RECOVERRMAN> RECOVER DATABASE NOREDO;8....On Standby Database.SQL> select name,open_mode,CURRENT_SCN from v$database;SQL> select scn_to_timestamp(1447102) from dual; ---- e.g SCN NOS.select timestamp_to_scn('09-JAN-09:12:00:10') from dual;select timestamp_to_scn('10-JAN-14:10:00:10') from dual;select scn_to_timestamp(8733) from dual;select scn_to_timestamp(3196) from dual;SELECT TIMESTAMP_TO_SCN('10-JAN-14 10.00.09.000000000 AM') FROM dual;9....On Standby Database.*** START real time RECOVERY ***====================SELECT c.index_name, i.uniqueness, c.column_nameFROM user_indexes i, user_ind_columns cWHERE i.index_name = c.index_nameAND i.table_name = 'AMS_POLICY_DETAILS'ORDER BY c.index_name, c.column_position/select thread#,max(sequence#) from v$log_history group by thread#;create undo tablespace UNDOTBS002 datafile size 100M;create undo tablespace UNDOTBS001 datafile size 100M;select sum(bytes/1024/1024/1024) from dba_segments;CREATE PUBLIC DATABASE LINK "CC_UAT1"connect to WONUAT identified by WONUATusing 'CCUAT';Fcubuat2$drop DATABASE LINK "FCCUAT.FCUBSMOLINK";CREATE DATABASE LINK "FCUBSMOLINK"connect to FCCMO_READ identified by Fccmo_1234using 'MFUBSFLL25';select DBMS_METADATA.GET_DDL('DB_LINK',db_link,OWNER) db_link_ddlfrom dba_db_linkswhere db_link like '%&DB_LINK_Char%';set long 9999999select DBMS_METADATA.GET_DDL('TABLESPACE','TEMP') TEMP_TBS from dual;from v$tempfilewhere name like '%&DB_LINK_Char%';set long 9999999select DBMS_METADATA.GET_DDL('TABLESPACE',tablespace_name) TBS from dba_tablespaces where tablespace_name like 'SYSAUX';BAAN.TTFGLD106954 set long 9999999select DBMS_METADATA.GET_DDL('TABLE',table_name) TBS from dba_tables where table_name like 'TTFGLD106954';set long 9999999select DBMS_METADATA.GET_DDL('TABLE',table_name) TBS from dba_tables where table_name like 'COMP_CUSTOMER_HISTORY' and owner='CDB_ADMIN';drop DATABASE LINK ARCHLINK_ECOD$.WORLD;CREATE DATABASE LINK FLEXPROD_HOST.ARCHLINK_ECOD$.WORLDCONNECT TO FC_ARCH_READ IDENTIFIED BY VALUES '05066CCD3894D446CB9C182BB5A2C0C5ABD2E8DC8ABF0DE9EB'USING 'FCARCDB';col owner for a20col directory_path for a60set lines 150set pages 999select * from dba_directories;col GRANTEE for a20col GRANTOR for a10col PRIVILEGE for a15select * from dba_tab_privs where table_name in (select DIRECTORY_NAME from dba_directories);CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE '/u005/oradata/FDM11DVT/temp1_01.dbf' SIZE 1048M; EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1048576;select DBMS_METADATA.GET_DDL('TABLESPACE','TEMP') from dual;select DBMS_METADATA.GET_DDL('TABLESPACE','AMS_MASTER_DATA') from dual;select DBMS_METADATA.GET_DDL('TABLESPACE','OCCLSS') from dual;select DBMS_METADATA.GET_DDL('STARPERF',username) db_SCHEMAfrom dba_USERSwhere username like 'STARPERF';set long 9999999select DBMS_METADATA.GET_DDL('USER',username) db_SCHEMAfrom dba_USERSwhere username like 'NEOLOG';CREATE PUBLIC DATABASE LINK "AMS_Prod"connect to AMSUAT identified by AMSUATusing 'HDFCPROD11';CREATE PUBLIC DATABASE LINK "HDFCDBIDB"connect to IDBDOC identified by IDBDOCusing 'IDBPROD';drop PUBLIC DATABASE LINK "AMS_Prod"select 'grant select on ams.' || object_name || ' to amsuat;' from dba_objects where owner='AMS' and object_type = 'TABLE';select dbms_metadata.get_ddl ('TABLE', 'AMS_USER_MASTER', 'AMS') from dual;select dbms_metadata.get_ddl ('TABLE', 'AUD$', 'SYS') from dual;select dbms_metadata.get_ddl ('TABLE', 'TTFGLD106954', 'BAAN') from dual;select DBMS_METADATA.GET_DDL('TABLE',table_name,owner) TBS from dba_tables where table_name like 'TTFGLD106954' and owner='BAAN';select dbms_metadata.get_ddl ('DB_LINK', 'CC_UAT', 'PUBLIC') from dual;select dbms_metadata.get_ddl ('TABLE', 'KU$NOEXP_TAB1', 'SYS') from dual;set long 999999999select DBMS_METADATA.GET_DDL('TABLE',table_name,owner) TBS from dba_tables where table_name like 'COMP_CUSTOMER_HISTORY' and owner='CDB_ADMIN';set long 999999999select DBMS_METADATA.GET_DDL('USER','STARPERF') db_SCHEMA from dual;set long 999999999select DBMS_METADATA.GET_DDL('USER','SAM_NEW') db_SCHEMA from dual; CREATE USER "STARPERF" IDENTIFIED BY VALUES 'S:072FA01B7A9502EA75A18766B2385FF6E827222215087CC72929D7721858;3C117B8C67D369D3'DEFAULT TABLESPACE "AMS_TRANSACTION_DATA"TEMPORARY TABLESPACE "TEMP"column host format a6column username format a10column os_user format a8column program format a30column tsname format a12selectb.machine host,b.username username,b.server,b.osuser os_user,b.program program,a.tablespace_name ts_name,row_wait_file# file_nbr,row_wait_block# block_nbr,c.owner,c.segment_name,c.segment_typefromdba_data_files a,v$session b,dba_extents cwhereb.row_wait_file# = a.file_idandc.file_id = row_wait_file#androw_wait_block# between c.block_id and c.block_id + c.blocks - 1androw_wait_file# <> 0andtype='USER';=================http://www.idevelopment.info/data/Oracle/DBA_tips/Automatic_Storage_Management/ASM_36.shtmlMoving database files from one diskgroup/mountpoint to other in ASM using RMAN1) Database should be in archive log mode.2) Take file offline which needs to be moved.SQL > alter database datafile '+DATA1/hdfcuat/datafile/undotbs3.268.730589449' offline;3) Use below cmd to copy datafile to other directory/mountpoint using below RMAN cmd. It will create file in other location with different name.RMAN > COPY DATAFILE '+DATA1/hdfcuat/datafile/undotbs3.268.730589449' TO '+DATA2';Above will create file in other location with different name.4) Once the RMAN cmd is successfully executed, use below cmd to Rename old file to new file name.SQL > ALTER DATABASE RENAME FILE '+DATA1/hdfcuat/datafile/undotbs3.268.730589449' to '+DATA2/hdfcuat/datafile/undotbs3.256.732542101';5) Use below RMAN cmd to rename the ASM database file copy. RMAN> SWITCH DATAFILE '+DATA2/hdfcuat/datafile/undotbs3.256.732542101' TO COPY;6) Recover the New ASM datafile. (Copy all the archives in one location/server if there are multiple instances)SQL> RECOVER DATAFILE '+DATA2/hdfcuat/datafile/undotbs3.256.732542101';7) Bring New ASM datafile online.SQL> ALTER DATABASE DATAFILE '+DATA2/hdfcuat/datafile/undotbs3.256.732542101' ONLINE;8) Check status and file name with new location.SELECT file_name FROM dba_data_files;9) Drop old named datafile using below cmd if it exist in old path.SQL> ALTER DISKGROUP +DATA1 DROP FILE '+DATA1/hdfcuat/datafile/undotbs3.268.730589449';==========================================================================We have created external table for Querying the CSV file from the same server & from Other Server. From the same server we are able to query & the ouput is fune , but to query the CSV file datas from other server we are facing Problem , below:SQL> select * from test;select * from test*ERROR at line 1:ORA-29913: error in executing ODCIEXTTABLEOPEN calloutORA-29400: data cartridge errorerror opening file \\HSLCC2\scott\TEST_3208_6236.logWindows Server 2003 Enterprise x64 Edition (64Bit)===============SQL> select tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%UNDO%';TABLESPACE_NAME FILE_NAME BYTES/1024/1024 AUT------------------------------ ----------------------------------------------------------------- --------------- ---UNDOTBS1 - hdfcuat1 +FRA/hdfcuat/datafile/undono1_11.dbf 2116.1875 YESUNDOTBS2 - hdfcuat2 +DATA/hdfcuat/datafile/undotbs2.311.683717465 104 NOUNDOTBS2 +DATA/hdfcuat/datafile/undotbs2.310.683717495 150 NOUNDOTBS2 +DATA/hdfcuat/datafile/undotbs2.267.683717531 213 NOUNDOTBS2 +FRA/hdfcuat/datafile/undotbs2.489.704573057 5400 YESUNDOTBS002 +FRA/hdfcuat/datafile/undotbs002.492.716165505 100 NOUNDOTBS2 +FRA/hdfcuat/datafile/undotbs2.487.704587779 3400 YESUNDOTBS_01 +FRA/hdfcuat/datafile/undono1_1.dbf 7976.125 YESUNDOTBS001 +DATA/hdfcuat/datafile/undotbs001.348.716165603 100 NO9 rows selected.prompt ======================TEMP TABLESPACE=================================================SELECT tablespace_name, SUM(bytes_used/1024), SUM(bytes_free/1024)FROM V$temp_space_headerGROUP BY tablespace_name;prompt =================Finds Possible TABLESPACE Datafile to shrink==========================================@shrink@select 'alter database datafile '''||file_name ||''' resize '|| ceil( (nvl(hwm,1)*8192)/1024/1024 )||'m;' cmd from dba_data_files a, ( select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b where a.file_id = b.file_id(+) and ceil(blocks*8192/1024/1024)- ceil((nvl(hwm,1)*8192)/1024/1024 ) > 0;prompt ======================Possible TABLESPACE to Coalesce =================================================select a.tablespace_name, a.file_id, a.block_id, a.blocks,b.block_idfrom dba_free_space a, dba_free_space bwhere a.tablespace_name like '%DATA%'and b.tablespace_name like '%DATA%'and a.file_id = b.file_idand a.block_id+a.blocks = b.block_id;DBA=====vinay 9820468856Dhawal 9833105884prasad 9920769718 prompt ======================Possible Alter Database TABLESPACE=================================================select 'alter database datafile '''||file_name ||''' resize '|| ceil( (nvl(hwm,1)*8192)/1024/1024 )||'m;' cmd from dba_data_files a, ( select file_id, max(block_id+blocks-1) hwm from dba_extents group by file_id ) b where a.file_id = b.file_id(+) and ceil(blocks*8192/1024/1024)- ceil((nvl(hwm,1)*8192)/1024/1024) > 0and tablespace_name like '%UNDO%';column file_name format a65column tablepsace_name format a22set pages 200set lines 160select file_id,tablespace_name,file_name,bytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%SYSTEM%';select file_id,file_name,blocks,MAXBLOCKS from dba_data_files where TABLESPACE_NAME = 'SYSTEM';select file_id,max(block_id) from dba_extents where TABLESPACE_NAME = 'SYSTEM' group by file_id;===================================================================Datafile set linesize 150column file_name format a50column tablespace_name format a10column free_space format 9999.9999select ddf.file_name,ddf.tablespace_name,sum(dfs.bytes)/1024/1024 free_spacefrom dba_data_files ddf, dba_free_space dfswhere ddf.file_id = dfs.file_idand ddf.tablespace_name like 'USERS'group by ddf.file_name,ddf.tablespace_name;===================================================================External Value -- Hidden ParametersSELECT KSPFTCTXPN PARAMETER_NUMBER,KSPPINM PARAMETER_NAME,KSPPITY PARAMETER_TYPE,KSPFTCTXVL PARAMETER_VALUE,KSPFTCTXDF IS_DEFAULT,KSPPIFLG MODIFICATION_FLAG,KSPFTCTXVF VALUE_FLAGFROM X$KSPPI X, X$KSPPCV2 YWHERE (X.INDX+1) = KSPFTCTXPNand KSPPINM LIKE '%_px_xtgranule_size%';SELECT KSPFTCTXPN PARAMETER_NUMBER,KSPPINM PARAMETER_NAME,KSPPITY PARAMETER_TYPE,KSPFTCTXVL PARAMETER_VALUE,KSPFTCTXDF IS_DEFAULT,KSPPIFLG MODIFICATION_FLAG,KSPFTCTXVF VALUE_FLAGFROM X$KSPPI X, X$KSPPCV2 YWHERE (X.INDX+1) = KSPFTCTXPNand KSPPINM LIKE '%_compression_comp%';SELECT KSPFTCTXPN PARAMETER_NUMBER,KSPPINM PARAMETER_NAME,KSPPITY PARAMETER_TYPE,KSPFTCTXVL PARAMETER_VALUE,KSPFTCTXDF IS_DEFAULT,KSPPIFLG MODIFICATION_FLAG,KSPFTCTXVF VALUE_FLAGFROM X$KSPPI X, X$KSPPCV2 YWHERE (X.INDX+1) = KSPFTCTXPNand KSPPINM LIKE '%_job_queue_interval%';SELECT KSPFTCTXPN PARAMETER_NUMBER,KSPPINM PARAMETER_NAME,KSPPITY PARAMETER_TYPE,KSPFTCTXVL PARAMETER_VALUE,KSPFTCTXDF IS_DEFAULT,KSPPIFLG MODIFICATION_FLAG,KSPFTCTXVF VALUE_FLAGFROM X$KSPPI X, X$KSPPCV2 YWHERE (X.INDX+1) = KSPFTCTXPNand KSPPINM LIKE '%_cr_server_log_flush%';SELECT KSPFTCTXPN PARAMETER_NUMBER,KSPPINM PARAMETER_NAME,KSPPITY PARAMETER_TYPE,KSPFTCTXVL PARAMETER_VALUE,KSPFTCTXDF IS_DEFAULT,KSPPIFLG MODIFICATION_FLAG,KSPFTCTXVF VALUE_FLAGFROM X$KSPPI X, X$KSPPCV2 YWHERE (X.INDX+1) = KSPFTCTXPNand KSPPINM LIKE '%_fix_control%';SELECT KSPFTCTXPN PARAMETER_NUMBER,KSPPINM PARAMETER_NAME,KSPPITY PARAMETER_TYPE,KSPFTCTXVL PARAMETER_VALUE,KSPFTCTXDF IS_DEFAULT,KSPPIFLG MODIFICATION_FLAG,KSPFTCTXVF VALUE_FLAGFROM X$KSPPI X, X$KSPPCV2 YWHERE (X.INDX+1) = KSPFTCTXPNand KSPPINM LIKE '%_allow_resetlogs_corruption%';_allow_resetlogs_corruptionalter system set "_allow_resetlogs_corruption"=TRUE scope=spfile;SQL> alter system set "_compression_compatibility"='11.2.0.0.0' scope=both;System altered.SQL>SQL>Hi,Possible hot blocks in the buffer cache normally can be identified by a high or rapid increasing wait count on the CACHE BUFFERS CHAINS latch. This latch is acquired when searching for data blocks cached in the buffer cache. Since the Buffer cache is implemented as a sum of chains of blocks, each of those chains is protected by a child of this latch when needs to be scanned. Contention in this latch can be caused by very heavy access to a single block. This can require the application to be reviewed. ACTION PLAN===========Please perform the following action plan during the time of issue.First determine which latch id(ADDR) are interesting by examining the number of sleeps for this latch. The higher the sleep count, the more interesting the latch id(ADDR) is:SQL> select CHILD# "cCHILD", ADDR "sADDR", GETS "sGETS", MISSES "sMISSES", SLEEPS "sSLEEPS" from v$latch_children where name = 'cache buffers chains'order by 5, 1, 2, 3;Run the above query a few times to to establish the id(ADDR) that has the most consistent amount of sleeps. Once the id(ADDR) with the highest sleep count is foundthen this latch address can be used to get more details about the blockscurrently in the buffer cache protected by this latch. The query below should be run just after determining the ADDR with the highest sleep count.SQL> column segment_name format a35select /*+ RULE */e.owner ||'.'|| e.segment_name segment_name,e.extent_id extent#,x.dbablk - e.block_id + 1 block#,x.tch,l.child#fromsys.v$latch_children l,sys.x$bh x,sys.dba_extents ewherex.hladdr = '&ADDR' ande.file_id = x.file# andx.hladdr = l.addr andx.dbablk between e.block_id and e.block_id + e.blocks -1order by x.tch desc ;Example of the output :SEGMENT_NAME EXTENT# BLOCK# TCH CHILD#-------------------------------- ------------ ------------ ------ ----------SCOTT.EMP_PK 5 474 17 7,668SCOTT.EMP 1 449 2 7,668column segment_name format a35select /*+ RULE */e.owner ||'.'|| e.segment_name segment_name,e.extent_id extent#,x.dbablk - e.block_id + 1 block#,x.tch,l.child#fromsys.v$latch_children l,sys.x$bh x,sys.dba_extents ewherex.hladdr = '&ADDR' ande.file_id = x.file# andx.hladdr = l.addr andx.dbablk between e.block_id and e.block_id + e.blocks -1order by x.tch desc ;www.tirumala.orgselect * from (select CHILD# "cCHILD", ADDR "sADDR", GETS "sGETS", MISSES "sMISSES", SLEEPS "sSLEEPS" from v$latch_children where name = 'cache buffers chains' and rownum <= 20order by 5 desc) awhere rownum <= 20;Depending on the TCH column (The number of times the block is hit by a SQL statement), you can identify a hotblock. The higher the value of the TCH column,the more frequent the block is accessed by SQL statements.In order to reduce contention for this object the following mechanisms can be put in place:1) Examine the application to see if the execution of certain DML and SELECT statements can be reorganized to eliminate contention on the object.2) Decrease the buffer cache -although this may only help in a small amount of cases.3) DBWR throughput may have a factor in this as well.If using multiple DBWR's then increase the number of DBWR's.4) Increase the PCTFREE for the table storage parameters via ALTER TABLE or rebuild. This will result in less rows per block.5) Consider implementing reverse key indexes (if range scans aren't commonly used against the segment)2)Also upload the AWR report for the duration of 60min during the Good & Bad Period.RegardsNaveenselect 'alter system kill session ''' || sid || ',' || serial# || ''' immediate;' "sids", to_char(logon_time,'dd-mm-yyyy hh24:mi'),username,schemaname,program from v$session where sid in (select SESSION_ID from v$locked_object where object_id = 172419)order by 2;col schemaname for a10col program for a30col sids for a70select 'alter system kill session ''' || sid || ',' || serial# || ''' immediate;' "sids", to_char(logon_time,'dd-mm-yyyy hh24:mi'),status,username,schemaname,program from v$session where logon_time < sysdate - 20 and schemaname not like 'SYS%'order by 2;select sid,event,schemaname,module,to_char(logon_time,'dd/mm/yyyy hh:mi') from v$session where event like 'latch%' order by 5;==================================================================================DBAsupport.com Forums > Archives > Forum Archives > PCTFREE Vs PCTUSED--------------------------------------------------------------------------------PDAClick to See Complete Forum and Search --> : PCTFREE Vs PCTUSED--------------------------------------------------------------------------------ckwan02-23-2001, 08:12 PMDear all,I want to pour some questions on the above topic questions :1. I come across a statement saying that PCTUSED Parameter explanation - After a data block becomes full, as determined by PCTFREE, Oracle does not consider the block for the insertion of new rows until the percentage of the block being used falls below the parameter PCTUSED. Before this value is archived, Oracle uses the free space of the data block only for updates to rows already contained in the data block.Q : What is the reason for this - PCTUSED ? Why they want to control that parameter ? Can I set it to 0 ? Q: Is free list this pre-allocated ? Is this only use for PCTFREE ? Where does it store ?Your answer is very much appreciated. Thanks.--------------------------------------------------------------------------------IT_girl20002-24-2001, 02:04 AMhope this will provide you your answer...The PCTFREE parameter specifies the percentage of space in each data block that is reserved for growth resulting from updates of rows in that data block. This parameter has a default value of 10 percent.For example, the value of the PCTFREE parameter is specified as 20 in a CREATE TABLE statement. This indicates that inserts to the block should stop as soon as free space drops to 20 percent or less. The free space thereafter can only be used for updates.The PCTUSED parameter represents the minimum percentage of the used space that the Oracle server tries to maintain for each data block of the table. This parameter has a default value of 40 percent.When a data block is filled to the limit determined by the value of the PCTFREE parameter, Oracle considers the block unavailable for the insertion of new rows. The block is unavailable for the insertion of new rows until the percentage filled by the data of that block falls below the value of the PCTUSED parameter.Until the percentage of the block falls below the value of the PCTUSED parameter, Oracle uses the free space of the data block only for updating the rows contained in the data block.For example, if PCTUSED is defined as 40 percent, the block is reused for inserts as soon as utilization drops to less than 40 percent. Inserts continue until utilization reaches 80 percent and the cycle repeats.--------------------------------------------------------------------------------rohitsn02-24-2001, 02:31 AMPctused and Pctfree are block storage parameters.Pctused is used to find out how much percentage of the block will be used to store rows.Pctfree is used to find out how much percentage of the block will be used to store rows resulting from further updates to the rows in the same datablock.Eg. If u keep pctused to 40% and pctfree 20.so u can insert rows till 40 %.if the limit exceeds 40%,still also u can insert rows in the datablock till the limit reaches 80% (100%-20%) as u have kept pctfree to 20%.Now if one goes on deleting the rows,the block is not said to be free unless and until pctused falls below 40%.As soon as pctused falls below 40% from deleting the rows, that block can be used to insert the rows.In this way the cycle continous.So it is recommended that u never sum up pctused+pctfree=100.Always have some gap between them this helps in reducing ur Oracle server for allocation and disallocation of freelists.If any further doubts write to rohitsn@hotmail.com--------------------------------------------------------------------------------tamilselvan02-25-2001, 11:48 AMThis is an interesting question. I would like to share my experience. In the last 3 months, I had interviewed 15 Oracle DBAs and asked the same question. Only one person answered correctly. Both the parameters are applicable and used for each data block in the Database. I hope an example will give you the right answer.Consider 8K block size. The total bytes 8 x 1024 = 8196 bytesEach block requires approximately 117 bytes for the header. Please note that the header size varies depending upon the block size. The total available bytes for data = ( 8196 – 117) = 8079 bytes.A table is created with PCTFREE 20 PCTUSED 50 .PCTRFREE in bytes = 1615PCTUSED in bytes = 4039 Now the data available for insert and update = (8079 – (20 * 8079)/100 ) = 6463 Bytes.Now user can insert new rows into this block as long as the old rows’ total bytes + new row’s total byte is less than or equal to 6463 bytes. If the new row’s total byte cannot be put into this block, then Oracle will get the next block from the free list, and inserts into it.When a row is updated and the row’s data is expanded, then PCTFREE come into play. The updated row’s data is placed into PCTFREE’s area, provided the updated row’s new data can be fit into PCTFREE area. If it is not fit into that area, another new block will be obtained from the Freelist, and the row will be migrated. But the original row info (pointer) is kept in the old block. For subsequent access to this row involves 2 read I/O. That is why row migration should be avoided because of excessive I/Os.ROW DELETION:The PCTUSED parameter value (in this example 50 %) is the threshold limit for the old block to be added in the FREELIST. To understand better, let us assume that a block is of full data. Now the user starts deleting rows from the block. When a row is deleted, Oracle does not put the block into the FREELIST because it requires many recursive calls to update the FREELIST. The PCTUSED % (50) determines when the block should be added into FREELIST. When the total bytes in the block is less than or equal to 4039 bytes, then the block will be added into FREELIST. If a table has high inserts and high deletion, then you should decrease the PCTUSED value in order to minimize the frequent update of FREELIST.The best confidence booster is knowledge. Good Luck, guys.--------------------------------------------------------------------------------tamilselvan02-26-2001, 11:03 AMCorrection in earlier post. The overhead for each block is 107 bytes, not 117 bytes.Tamilselvan--------------------------------------------------------------------------------sambavan02-26-2001, 11:27 AMThat was one damn good explanation. But on reading this thread, I'm getting more questions than that of answers.1. How do one get to check the over head for different block_sizes.2. What happens when one sets the PCTFREE to 80%Sorry for such a lame question, but was curious to know the answer, atleast to the first one.Thanx,Sam--------------------------------------------------------------------------------tamilselvan02-26-2001, 11:41 AMOracle says the overhead for each block varies from 84 bytes to 107 bytes. I do not know how to cross check over head bytes for various block sizes.Does anybody know the answer?--------------------------------------------------------------------------------pando02-26-2001, 11:44 AMif pctfree is high then basically we are wasting hard drive space since only 10% of block is used for inserts, of course if you consider that you will update the rows so often and fill the 80% up then it´s up to you but I think it´s pretty rareI say 10% but it can be less since pctfree+pctused cant be more than 100 and if we set pctused 20 and pctfree 80 most probably we will face perfomance issues because the block has to be put on freelist and taken off free list all the time.As for block overhead I think there is a formula in Oracle DBA Handbook--------------------------------------------------------------------------------badrinathn02-26-2001, 11:47 AMTo add on to the question pool,I understand that the pctused is used by oracle to put the block into the free list for future inserts.1) Will any new blocks(extends) added will directly put into the freelist ?2) I know that I have a table, in which I rarely have any updates and deletes but only insertions, then can I set the parameters for PCT FREE = 100and PCT USED=0?Badrinath--------------------------------------------------------------------------------LND02-26-2001, 12:11 PMbadrinathn:on site http://www.ixora.com.au/q+a/datablock.htm is good discussion of that issue. from my understanding, new blocks goes to so called master free list. pctused=0 and pctfree=100 would make sense for insert only table.--------------------------------------------------------------------------------rsuri02-26-2001, 12:48 PMshouldn't pctfree be more like 'Zero' for insert-only table ?pctfree = 100 means nothing can be inserted !--------------------------------------------------------------------------------badrinathn02-26-2001, 12:52 PMHey, Thats correct,In that case , for a insert only tables it means pctfree = 0andpctused = 0Advisors, what do you say?--------------------------------------------------------------------------------tamilselvan02-26-2001, 02:02 PMWhen PCTFREE is set to 0, then every update on a row requires a row migration. When PCTUSED is set to 0 , then after deleting all rows in the block, it will be added into FREELIST.--------------------------------------------------------------------------------pranavgovind12-19-2007, 09:22 PMAll,I just read this thread and i see very useful information. I just want to share my thoughts for PCTUSED Vs PCTFREE for insert only tables. PCTFREE = 0 AND PCTUSED value does matter for insert only tables. PCTUSED will not play the role as long as we are not deleting any data in the block. Another point here is, we can not set PCTUSED=100 or PCTFREE = 100. The value 100 is invalid value. Also sum of PCTUSED and PCTFREE can not exceed 100. Pease reply if any one is not agreeing. ThanksSQL> create table test2 (no number)3 pctused 04 pctfree 100;pctfree 100*ERROR at line 4:ORA-02211: invalid value for PCTFREE or PCTUSEDSQL> create table test(no number)2 pctused 603 pctfree 41;create table test(no number)*ERROR at line 1:ORA-04000: the sum of PCTUSED and PCTFREE cannot exceed 100--------------------------------------------------------------------------------davey23uk12-21-2007, 02:17 PMits 6 years old for gods sake--------------------------------------------------------------------------------dbasupport.comCopyright 2010 Internet.com Inc. All Rights Reserved. =============================================================================================== DatagaurdMax Details in \\10.50.11.28\d$\ronak\Datagaurd folderselect sequence#, applied from v$archived_log order by sequence#;alter database recover managed standby database disconnect from session;alter database recover managed standby database cancel;col name for a13col value for a13col unit for a30set lines 132select name, value, unit, time_computed from v$dataguard_stats where name in ('transport lag', 'apply lag');select to_char(start_time, 'DD-MON-RR HH24:MI:SS') start_time, item , sofarfrom v$recovery_progresswhere item in ('Active Apply Rate', 'Average Apply Rate', 'Redo Applied');@genarc:-------select to_char(trunc(first_time), 'Mon DD') "DG Date",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "12am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "01am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "02am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "03am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "04am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "05am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "06am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "07am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "08am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "09am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "10am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "11am",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "12pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "01pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "02pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "03pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "04pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "05pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "06pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "07pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "08pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "09pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "10pm",to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "11pm"from v$log_historygroup by trunc(first_time)order by trunc(first_time) desc;select thread#, low_sequence#, high_sequence# from v$archive_gap; select dest_id,max(sequence#), thread# from v$archived_log group by thread#,dest_id;## On the primary run the belowselect L.thread#, L.sequence#from(select thread#, sequence# from v$archived_log where dest_id=1) L where L.sequence# not in (select sequence# from v$archived_log where dest_id=2 and thread# = L.thread#); select to_char(start_time, 'DD-MON-RR HH24:MI:SS') start_time, item , sofarfrom v$recovery_progresswhere item in ('Active Apply Rate', 'Average Apply Rate', 'Redo Applied');col name for a13col value for a13col unit for a30set lines 132select name, value, unit, time_computed from v$dataguard_stats where name in ('transport lag', 'apply lag');col name for a25col value for a20col unit for a40select distinct name, value, unit, time_computed from v$dataguard_stats;SELECT MESSAGE FROM V$DATAGUARD_STATUS;select message, to_char(timestamp,’HH:MI:SS’) timestampfrom v$dataguard_statuswhere severity in (‘Error’,’Fatal’)order by timestampcol type for a30col COMMENTS for a30select * from v$recovery_progress;col client_pid for a10; select pid, process, status, client_process, client_pid, thread#, sequence#, block#, blocks from v$managed_standby; select * from V$ARCHIVE_DEST_STATUS where dest_name like 'LOG_ARCHIVE_DEST_2';select current_scn from v$database;select scn_to_timestamp(190469922) from dual;======================================================================================= PGAFrom Oracle FAQJump to: navigation, searchThe PGA (Program or Process Global Area) is a memory area (RAM) that stores data and control information for a single process. For example, it typically contains a sort area, hash area, session cursor cache, etc. [edit] Auto tuning PGA areas can be sized manually by setting parameters like hash_area_size, sort_area_size etc. To allow Oracle to auto tune the PGA areas, set the WORKAREA_SIZE_POLICY parameter to AUTO and the PGA_AGGREGATE_TARGET to the size of memory that can be used for PGA. This feature was introduced in Oracle 9i. Oracle 11g allows users to tune both PGA and SGA areas with a single parameter, called MEMORY_TARGET. [edit] MonitorPGA usage statistics: select * from v$pgastat;Determine a good setting for pga_aggregate_target: select * from v$pga_target_advice order by pga_target_for_estimate;Show the maximum PGA usage per process: select max(pga_used_mem), max(pga_alloc_mem), max(pga_max_mem) from v$process;# tnsnames.ora.ideasmintdb Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora.ideasmintdb# Generated by Oracle configuration tools.IPC =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = IPC)(KEY = IPC_test1)))(CONNECT_DATA =(SERVICE_NAME = IDEAS2)))MINT =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MINTIDEASDB-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = MINT)(FAILOVER_MODE =(TYPE = SELECT)(METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))HDFCDBPROD =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.0.201)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = HDFCDB)))LISTENER_MINT2 =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.1.95)(PORT = 1521))LISTENER_MINT1 =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.1.94)(PORT = 1521))LISTENERS_PINNACLE =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = MINTIDEASDB-vip)(PORT = 1521)))PINNACLE2 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = PINNACLE)(INSTANCE_NAME = PINNACLE2)))PINNACLE1 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MINTIDEASDB-vip)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = PINNACLE)(INSTANCE_NAME = PINNACLE1)))LISTENER_+ASM2 =(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521))PINNACLE =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = MINTIDEASDB-vip)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = PINNACLE)))hdfcprod_new = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 124.30.56.83)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 124.30.56.84)(PORT = 1521)) (LOAD_BALANCE = yes) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = hdfcprod) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5) ) ) ) MINT2 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = MINT)(INSTANCE_NAME = MINT2)))MINT1 =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = MINTIDEASDB-vip)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = MINT)(INSTANCE_NAME = MINT1)))IDEASUAT =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.0.252)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = IDEASUAT)))LISTENERS_MINT =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = MINTIDEASDB-vip)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = IDEASMINTDB-vip)(PORT = 1521)))===== GOLDEN GATESQL> @$GGATE/marker_setup.sql SQL> @$GGATE/ddl_setup.sql SQL> @$GGATE/role_setup.sql SQL> grant GGS_GGSUSER_ROLE to ggate; SQL> @$GGATE/ddl_enable.sql --extract group-- extract ext1 --connection to database-- userid ggate@prim, password qwerty --hostname and port for trail-- rmthost newods, mgrport 7807--path and name for trail-- rmttrail D:\GGS\v22234-01-170861\DIRDAT\CA--DDL support ddl include mapped objname sender.*; --DML table sender.* extract ext1 userid ggate@prim, password qwerty rmthost newods, mgrport 7807rmttrail D:\GGS\v22234-01-170861\DIRDAT\CEddl include mapped objname sender.*; table sender.* add exttrail D:\GGS\v22234-01-170861\DIRDAT\CE, extract ext1GGSCI (newods) 261> view params load1EXTRACT load1EXTTRAIL D:\GGS\v22234-01-170861\DIRDAT\CADISCARDFILE D:\GGS\v22234-01-170861\DIRRPT\EXTPUMP_DSC_CA.RPT,PURGEUSERID sys@prim, PASSWORD ggs sysdbaTABLE ggs.info;view params globalGGSCHEMA ggateCHECKPOINTTABLE ggate.checkpointdelete replicat rep1, exttrail D:\GGS\v22234-01-170861\DIRDAT\CA, checkpointtable ggate.checkpoint alter replicat rep3, exttrail D:\GGS\v22234-01-170861\DIRDAT\CE, checkpointtable ggate.checkpoint --Replicat group --replicat rep3--source and target definitionsASSUMETARGETDEFS--target database login --userid ggate@prim, password qwerty--file for dicarded transaction --discardfile D:\GGS\v22234-01-170861\DISCARD\rep3_discard.txt, append, megabytes 10--ddl supportDDL--Specify table mapping ---map sender.*, target rr.*;This example illustrates using the GoldenGate direct load method to extract records from an Oracle 11g database on Red Hat Linux platform and load the same into an Oracle 11g target database on an AIX platform.The table PRODUCTS in the SH schema on the source has 72 rows and on the target database the same table is present only in structure without any data. We will be loading the 72 rows in this example from the source database to the target database using GoldenGate Direct Load method.On Source1) Create the Initial data extract process ‘load1'GGSCI (redhat346.localdomain) 5> ADD EXTRACT load1, SOURCEISTABLEEXTRACT added.Since this is a one time data extract task, the source of the data is not the transaction log files of the RDBMS (in this case the online and archive redo log files) but the table data itself, that is why the keyword SOURCEISTABLE is used.2) Create the parameter file for the extract group load1EXTRACT: name of the extract groupUSERID/PASSWORD: the database user which has been configured earlier for Extract ( this user is created in the source database)RMTHOST: This will be the IP address or hostname of the target systemMGRPORT: the port where the Manager process is runningTABLE: specify the table which is being extracted and replicated. This can be specified in a number of ways using wildcard characters to include or exclude tables as well as entire schemas.GGSCI (redhat346.localdomain) 6> EDIT PARAMS load1EXTRACT load1USERID ggs_owner, PASSWORD ggs_ownerRMTHOST devu007, MGRPORT 7809RMTTASK replicat, GROUP load2TABLE sh.products;On Target3) Create the initial data load task ‘load2'Since this is a one time data load task, we are using the keyword SPECIALRUNGGSCI (devu007) 1> ADD REPLICAT load2, SPECIALRUNREPLICAT added.4) Create the parameter file for the Replicat group, load2REPLICAT: name of the Replicat group created for the initial data loadUSERID/PASSWORD: database credentials for the Replicat user (this user is created in the target database)ASSUMETARGETDEFS: this means that the source table structure exactly matches the target database table structureMAP: with GoldenGate we can have the target database structure entirely differ from that of the source in terms of table names as well as the column definitions of the tables. This parameter provides us the mapping of the source and target tables which is same in this caseGGSCI (devu007) 2> EDIT PARAMS load2“/u01/oracle/software/goldengate/dirprm/rep4.prm” [New file]REPLICAT load2USERID ggs_owner, PASSWORD ggs_ownerASSUMETARGETDEFSMAP sh.customers, TARGET sh.customers;On SourceSQL> select count(*) from products;COUNT(*)———-72On Target SQL> select count(*) from products;COUNT(*)———-0On Source5) Start the initial load data extract task on the source systemWe now start the initial data load task load 1 on the source. Since this is a one time task, we will initially see that the extract process is runningand after the data load is complete it will be stopped. We do not have to manually start the Replicat process on the target as that is done when the Extract task is started on the source system.On SourceGGSCI (redhat346.localdomain) 16> START EXTRACT load1Sending START request to MANAGER …EXTRACT LOAD1 startingGGSCI (redhat346.localdomain) 28> info extract load1EXTRACT LOAD1 Last Started 2010-02-11 11:33 Status RUNNINGCheckpoint Lag Not AvailableLog Read Checkpoint Table SH.PRODUCTS2010-02-11 11:33:16 Record 72Task SOURCEISTABLEGGSCI (redhat346.localdomain) 29> info extract load1EXTRACT LOAD1 Last Started 2010-02-11 11:33 Status STOPPEDCheckpoint Lag Not AvailableLog Read Checkpoint Table SH.PRODUCTS2010-02-11 11:33:16 Record 72Task SOURCEISTABLEOn TargetSQL> select count(*) from products;COUNT(*)———-72Coming Soon! – Creating an Online Extract and Replicat Group for Change Synchronization …..http://gavinsoorma.com/2010/02/goldengate-concepts-and-architecture/The Data Pump (not to be confused with the Oracle Export Import Data Pump) is an optional secondary Extract group that is created on the source system. When Data Pump is not used, the Extract process writes to a remote trail that is located on the target system using TCP/IP. When Data Pump is configured, the Extract process writes to a local trail and from here Data Pump will read the trail and write the data over the network to the remote trail located on the target system.The advantages of this can be seen as it protects against a network failure as in the absence of a storage device on the local system, the Extract process writes data into memory before the same is sent over the network. Any failures in the network could then cause the Extract process to abort (abend). Also if we are doing any complex data transformation or filtering, the same can be performed by the Data Pump. It will also be useful when we are consolidating data from several sources into one central target where data pump on each individual source system can write to one common trail file on the target.Create the Extract processGGSCI (devu007) 1> ADD EXTRACT ext1, TRANLOG, BEGIN NOWEXTRACT added.Create a local trailUsing the ADD EXTRAIL command we will now create a local trail on the source system where the Extract process will write to and which is then read by the Data Pump process. We will link this local trail to the Primary Extract group we just created, ext1GGSCI (devu007) 3> ADD EXTTRAIL /u01/oracle/software/goldengate/dirdat/lt, EXTRACT ext1EXTTRAIL added.Create the Data Pump groupOn the source system create the Data Pump group and using the EXTTRAILSOURCE keywork specify the location of the local trail which will be read by the Data Pump processGGSCI (devu007) 4> ADD EXTRACT dpump, EXTTRAILSOURCE /u01/oracle/software/goldengate/dirdat/ltEXTRACT added.Create the parameter file for the Primary Extract groupGGSCI (devu007) 5> EDIT PARAMS ext1“/u01/oracle/software/goldengate/dirprm/ext1.prm” [New file]EXTRACT ext1USERID ggs_owner, PASSWORD ggs_ownerEXTTRAIL /u01/oracle/software/goldengate/dirdat/ltTABLE MONITOR.WORK_PLAN;Specify the location of the remote trail on the target systemUse the RMTTRAIL to specify the location of the remote trail and associate the same with the Data Pump group as it will be wriiten to over the network by the data pump processGGSCI (devu007) 6> ADD RMTTRAIL /u01/oracle/ggs/dirdat/rt, EXTRACT dpumpRMTTRAIL added.Create the parameter file for the Data Pump groupNote- the parameter PASSTHRU signifies the mode being used for the Data Pump which means that the names of the source and target objects are identical and no column mapping or filtering is being performed here.GGSCI (devu007) 2> EDIT PARAMS dpump“/u01/oracle/software/goldengate/dirprm/dpump.prm” [New file]EXTRACT dpumpUSERID ggs_owner, PASSWORD ggs_ownerRMTHOST redhat346, MGRPORT 7809RMTTRAIL /u01/oracle/ggs/dirdat/rtPASSTHRUTABLE MONITOR.WORK_PLAN;ON TARGET SYSTEMCreate the Replicat groupThe EXTTRAIL clause indicates the location of the remote trail and should be the same as the RMTTRAIL value that was used when creating the Data Pump process on the source system.GGSCI (redhat346.localdomain) 2> ADD REPLICAT rep1, EXTTRAIL /u01/oracle/ggs/dirdat/rtREPLICAT added.Create the parameter file for the Replicat groupGGSCI (redhat346.localdomain) 3> EDIT PARAMS rep1REPLICAT rep1ASSUMETARGETDEFSUSERID ggs_owner, PASSWORD ggs_ownerMAP MONITOR.WORK_PLAN, TARGET MONITOR.WORK_PLAN;ON SOURCE On the source system, now start the Extract and Data Pump processes.GGSCI (devu007) 3> START EXTRACT ext1Sending START request to MANAGER …EXTRACT EXT1 startingGGSCI (devu007) 4> START EXTRACT dpumpSending START request to MANAGER …EXTRACT DPUMP startingGGSCI (devu007) 5> info extract ext1EXTRACT EXT1 Last Started 2010-02-18 11:23 Status RUNNINGCheckpoint Lag 00:40:52 (updated 00:00:09 ago)Log Read Checkpoint Oracle Redo Logs2010-02-18 10:42:19 Seqno 761, RBA 15086096GGSCI (devu007) 6> INFO EXTRACT dpumpEXTRACT DPUMP Last Started 2010-02-18 11:23 Status RUNNINGCheckpoint Lag 00:00:00 (updated 00:00:02 ago)Log Read Checkpoint File /u01/oracle/software/goldengate/dirdat/lt0000002010-02-18 11:15:10.000000 RBA 5403Note- the data pump process is reading from the Local Trail file – /u01/oracle/software/goldengate/dirdat/lt000000ON TARGET SYSTEM Start the Replicat processGGSCI (redhat346.localdomain) 4> START REPLICAT rep1Sending START request to MANAGER …REPLICAT REP1 startingGGSCI (redhat346.localdomain) 5> STATUS REPLICAT rep1REPLICAT REP1: RUNNINGComing Next! – DDL change synchronization …--Replicat group -- replicat rep1 --source and target definitions ASSUMETARGETDEFS --target database login -- userid ggate, password qwerty --file for dicarded transaction -- discardfile D:\GGS\v22234-01-170861\DISCARD\rep1_discard.txt, append, megabytes 10 --ddl support DDL --Specify table mapping --- map sender.*, target receiver.*; In addition to providing replication support for all DML statements, we can also configure the GoldenGate environment to provide DDL support as well.A number of prerequisite setup tasks need to be performed which we willl highlight here.Run the following scripts from the directory where the GoldenGate software was installed.The assumption here is that the database user GGS_OWNER has already been created and granted the required roles and privileges as discussed in our earlier tutorial.Note - run the scripts as SYSDBASQL> @marker_setupMarker setup scriptYou will be prompted for the name of a schema for the GoldenGate database objects.NOTE: The schema must be created prior to running this script.NOTE: Stop all DDL replication before starting this installation.Enter GoldenGate schema name:GGS_OWNERMarker setup table script complete, running verification script...Please enter the name of a schema for the GoldenGate database objects:Setting schema name to GGS_OWNER======Oracle GoldenGate not only provides us a replication solution that is Oracle version independent as well as platform independent, but we can also use it to do data transformation and data manipulation between the source and the target.So we can use GoldenGate when the source and database database differ in table structure as well as an ETL tool in a Datawarehouse type environment.We will discuss below two examples to demonstrate this feature – column mapping and filtering of data.In example 1, we will filter the records that are extracted on the source and applied on the target – only rows where the JOB column value equals ‘MANAGER” in the MYEMP table will be considered for extraction.In example 2, we will deal with a case where the table structure is different between the source database and the target database and see how column mapping is performed in such cases.Example 1Initial load of all rows which match the filter from source to target. The target database MYEMP table will only be populated with rows from the EMP table where filter criteria of JOB=’MANAGER’ is met.On SourceGGSCI (redhat346.localdomain) 4> add extract myload1, sourceistableEXTRACT added.GGSCI (redhat346.localdomain) 5> edit params myload1EXTRACT myload1USERID ggs_owner, PASSWORD ggs_ownerRMTHOST devu007, MGRPORT 7809RMTTASK replicat, GROUP myload1TABLE scott.myemp, FILTER (@STRFIND (job, “MANAGER”) > 0);On TargetGGSCI (devu007) 2> add replicat myload1, specialrunREPLICAT added.GGSCI (devu007) 3> edit params myload1“/u01/oracle/software/goldengate/dirprm/myload1.prm” [New file]REPLICAT myload1USERID ggs_owner, PASSWORD ggs_ownerASSUMETARGETDEFSMAP scott.myemp, TARGET sh.myemp;On Source – start the initial load extract GGSCI (redhat346.localdomain) 6> start extract myload1Sending START request to MANAGER …EXTRACT MYLOAD1 startingOn SOURCESQL> select count(*) from myemp;COUNT(*)———-14SQL> select count(*) from myemp where job=’MANAGER’;COUNT(*)———-9On TARGET SQL> select count(*) from myemp where job=’MANAGER’;COUNT(*)———-9Create an online change extract and replicat group using a FilterGGSCI (redhat346.localdomain) 10> add extract myload2, tranlog, begin nowEXTRACT added.GGSCI (redhat346.localdomain) 11> add rmttrail /u01/oracle/software/goldengate/dirdat/bb, extract myload2RMTTRAIL added.GGSCI (redhat346.localdomain) 11> edit params myload2 EXTRACT myload2USERID ggs_owner, PASSWORD ggs_ownerRMTHOST 10.53.200.225, MGRPORT 7809RMTTRAIL /u01/oracle/software/goldengate/dirdat/bbTABLE scott.myemp, FILTER (@STRFIND (job, “MANAGER”) > 0);On TargetGGSCI (devu007) 2> add replicat myload2, exttrail /u01/oracle/software/goldengate/dirdat/bbREPLICAT added.GGSCI (devu007) 3> edit params myload2“/u01/oracle/software/goldengate/dirprm/myload2.prm” [New file]REPLICAT myload2ASSUMETARGETDEFSUSERID ggs_owner, PASSWORD ggs_ownerMAP scott.myemp, TARGET sh.myemp;On Source – start the online extract groupGGSCI (redhat346.localdomain) 13> start extract myload2Sending START request to MANAGER …EXTRACT MYLOAD2 startingGGSCI (redhat346.localdomain) 14> info extract myload2EXTRACT MYLOAD2 Last Started 2010-02-23 11:04 Status RUNNINGCheckpoint Lag 00:27:39 (updated 00:00:08 ago)Log Read Checkpoint Oracle Redo Logs2010-02-23 10:36:51 Seqno 214, RBA 103988On TargetGGSCI (devu007) 4> start replicat myload2Sending START request to MANAGER …REPLICAT MYLOAD2 startingGGSCI (devu007) 5> info replicat myload2REPLICAT MYLOAD2 Last Started 2010-02-23 11:05 Status RUNNINGCheckpoint Lag 00:00:00 (updated 00:00:08 ago)Log Read Checkpoint File /u01/oracle/software/goldengate/dirdat/bb000000First Record RBA 989On Source we now insert two rows into the MYEMP table – one which has the JOB value of ‘MANAGER’ and the other row which has the job value of ‘SALESMAN’On SOURCESQL> INSERT INTO MYEMP2 (empno,ename,job,sal)3 VALUES4 (1234,’GAVIN’,’MANAGER‘,10000);1 row created.SQL> commit;Commit complete.SQL> INSERT INTO MYEMP2 (empno,ename,job,sal)3 VALUES4 (1235,’BOB’,’SALESMAN‘,1000);1 row created.SQL> commit;Commit complete.SQL> select count(*) from myemp;COUNT(*)———-16SQL> select count(*) from myemp where job=’MANAGER’;COUNT(*)———-10On Target, we will see that even though two rows have been inserted into the source MYEMP table, on the target MYEMP table only one row is inserted because the filter has been applied which only includes the rows where the JOB value equals ‘MANAGER’.SQL> select count(*) from myemp;COUNT(*)———-10Example 2 – source and target table differ in column structureIn the source MYEMP table we have a column named SAL whereas on the target, the same MYEMP table has the column defined as SALARY.Create a definitions file on the source using DEFGEN utility and then copy that definitions file to the target systemGGSCI (redhat346.localdomain) > EDIT PARAMS defgenDEFSFILE /u01/oracle/ggs/dirsql/myemp.sqlUSERID ggs_owner, PASSWORD ggs_ownerTABLE scott.myemp;[oracle@redhat346 ggs]$ ./defgen paramfile /u01/oracle/ggs/dirprm/defgen.prm***********************************************************************Oracle GoldenGate Table Definition Generator for OracleVersion 10.4.0.19 Build 002Linux, x64, 64bit (optimized), Oracle 11 on Sep 18 2009 00:09:13Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.Starting at 2010-02-23 11:22:17***********************************************************************Operating System Version:LinuxVersion #1 SMP Wed Dec 17 11:41:38 EST 2008, Release 2.6.18-128.el5Node: redhat346.localdomainMachine: x86_64soft limit hard limitAddress Space Size : unlimited unlimitedHeap Size : unlimited unlimitedFile Size : unlimited unlimitedCPU Time : unlimited unlimitedProcess id: 14175************************************************************************* Running with the following parameters *************************************************************************DEFSFILE /u01/oracle/ggs/dirsql/myemp.sqlUSERID ggs_owner, PASSWORD *********TABLE scott.myemp;Retrieving definition for SCOTT.MYEMPDefinitions generated for 1 tables in /u01/oracle/ggs/dirsql/myemp.sqlIf we were to try and run the replicat process on the target without copying the definitions file, we will see an error as shown below which pertains to the fact that the columns in the source and target database are different and GoldenGate is not able to resolve that.2010-02-23 11:31:07 GGS WARNING 218 Aborted grouped transaction on ‘SH.MYEMP’, Database error 904 (ORA-00904: “SAL”: invalid identifier).2010-02-23 11:31:07 GGS WARNING 218 SQL error 904 mapping SCOTT.MYEMP to SH.MYEMP OCI Error ORA-00904: “SAL”: invalid identifier (status = 904), SQL .We then ftp the definitions file from the source to the target system – in this case to the dirsql directory located in the top level GoldenGate installed software directoryWe now go and make a change to the original replicat parameter file and change the parameter ASSUMEDEFS to SOURCEDEFS which provides GoldenGate with the location of the definitions file.The other parameter which is included is the COLMAP parameter which tells us how the column mapping has been performed. The ‘USEDEFAULTS’ keyword denotes that all the other columns in both tables are identical except for the columns SAL and SALARY which differ in both tables and now we are mapping the SAL columsn in source to the SALARY column on the target.REPLICAT myload2SOURCEDEFS /u01/oracle/software/goldengate/dirsql/myemp.sqlUSERID ggs_owner, PASSWORD ggs_ownerMAP scott.myemp, TARGET sh.myemp,COLMAP (usedefaults,salary = sal);We now go and start the originall replicat process myload2 which had abended because of the column mismatch (which has now been corrected via the parameter change) and we see that the process now is running without any error.now go and start the process which had failed after table modificationGGSCI (devu007) 2> info replicat myload2REPLICAT MYLOAD2 Last Started 2010-02-23 11:05 Status ABENDEDCheckpoint Lag 00:00:03 (updated 00:11:44 ago)Log Read Checkpoint File /u01/oracle/software/goldengate/dirdat/bb0000002010-02-23 11:31:03.999504 RBA 1225GGSCI (devu007) 3> start replicat myload2Sending START request to MANAGER …REPLICAT MYLOAD2 startingGGSCI (devu007) 4> info replicat myload2REPLICAT MYLOAD2 Last Started 2010-02-23 11:43 Status RUNNINGCheckpoint Lag 00:00:00 (updated 00:00:03 ago)Log Read Checkpoint File /u01/oracle/software/goldengate/dirdat/bb0000002010-02-23 11:31:03.999504 RBA 1461Coming Next! – Monitoring the GoldenGate environment …..MARKER TABLE-------------------------------OKMARKER SEQUENCE-------------------------------OKScript complete.SQL> alter session set recyclebin=OFF;Session altered.SQL> @ddl_setupGoldenGate DDL Replication setup scriptVerifying that current user has privileges to install DDL Replication...You will be prompted for the name of a schema for the GoldenGate database objects.NOTE: The schema must be created prior to running this script.NOTE: On Oracle 10g and up, system recycle bin must be disabled.NOTE: Stop all DDL replication before starting this installation.Enter GoldenGate schema name:GGS_OWNERYou will be prompted for the mode of installation.To install or reinstall DDL replication, enter INITIALSETUPTo upgrade DDL replication, enter NORMALEnter mode of installation:INITIALSETUPWorking, please wait ...Spooling to file ddl_setup_spool.txtUsing GGS_OWNER as a GoldenGate schema name, INITIALSETUP as a mode of installation.Working, please wait ...RECYCLEBIN must be empty.This installation will purge RECYCLEBIN for all users.To proceed, enter yes. To stop installation, enter no.Enter yes or no:yesDDL replication setup script complete, running verification script...Please enter the name of a schema for the GoldenGate database objects:Setting schema name to GGS_OWNERDDLORA_GETTABLESPACESIZE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsCLEAR_TRACE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsCREATE_TRACE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsTRACE_PUT_LINE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsINITIAL_SETUP STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsDDLVERSIONSPECIFIC PACKAGE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsDDLREPLICATION PACKAGE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsDDLREPLICATION PACKAGE BODY STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsDDL HISTORY TABLE-----------------------------------OKDDL HISTORY TABLE(1)-----------------------------------OKDDL DUMP TABLES-----------------------------------OKDDL DUMP COLUMNS-----------------------------------OKDDL DUMP LOG GROUPS-----------------------------------OKDDL DUMP PARTITIONS-----------------------------------OKDDL DUMP PRIMARY KEYS-----------------------------------OKDDL SEQUENCE-----------------------------------OKGGS_TEMP_COLS-----------------------------------OKGGS_TEMP_UK-----------------------------------OKDDL TRIGGER CODE STATUS:Line/pos Error---------- -----------------------------------------------------------------No errors No errorsDDL TRIGGER INSTALL STATUS-----------------------------------OKDDL TRIGGER RUNNING STATUS-----------------------------------ENABLEDSTAYMETADATA IN TRIGGER-----------------------------------OFFDDL TRIGGER SQL TRACING-----------------------------------0DDL TRIGGER TRACE LEVEL-----------------------------------0LOCATION OF DDL TRACE FILE--------------------------------------------------------------------------------/u01/app/oracle/diag/rdbms/gavin/gavin/trace/ggs_ddl_trace.logAnalyzing installation status...STATUS OF DDL REPLICATION--------------------------------------------------------------------------------SUCCESSFUL installation of DDL Replication software componentsScript complete.SQL>SQL> @role_setupGGS Role setup scriptThis script will drop and recreate the role GGS_GGSUSER_ROLETo use a different role name, quit this script and then edit the params.sql script to changethe gg_role parameter to the preferred name. (Do not run the script.)You will be prompted for the name of a schema for the GoldenGate database objects.NOTE: The schema must be created prior to running this script.NOTE: Stop all DDL replication before starting this installation.Enter GoldenGate schema name:GGS_OWNERWrote file role_setup_set.txtPL/SQL procedure successfully completed.Role setup script completeGrant this role to each user assigned to the Extract, GGSCI, and Manager processes, by using the following SQL command:GRANT GGS_GGSUSER_ROLE TOwhere is the user assigned to the GoldenGate processes.SQL> grant ggs_ggsuser_role to ggs_owner;Grant succeeded.SQL> @ddl_enableTrigger altered.SQL> @ddl_pin GGS_OWNERPL/SQL procedure successfully completed.PL/SQL procedure successfully completed.PL/SQL procedure successfully completed.Turn Recyclebin OFF We need to set the parameter recyclebin to OFF via the ALTER SYSTEM SET RECYCLEBIN=OFF command in order to prevent this error which we will see if we try and configure DDL support and then start the Extract process.2010-02-19 11:13:30 GGS ERROR 2003 RECYCLEBIN must be turned off. For 10gr2 and up, set RECYCLEBIN in parameter file to OFF. For 10gr1, set _RECYCLEBIN in parameter file to FALSE. Then restart database and extract.2010-02-19 11:13:30 GGS ERROR 190 PROCESS ABENDING.Enable additional logging at the table levelNote- We had earlier enabled additional supplemental logging at the database level. Using the ADD TRANDATA command we now enable it at even the table level as this is required by GoldenGate for DDL support.GGSCI (redhat346.localdomain) 5> DBLOGIN USERID ggs_owner, PASSWORD ggs_ownerSuccessfully logged into database.GGSCI (redhat346.localdomain) 6> ADD TRANDATA scott.empLogging of supplemental redo data enabled for table SCOTT.EMP.Edit the parameter file for the Extract process to enable DDL synchronization We had earlier created a parameter file for an Extract process ext1. We now edit that parameter file and add the entryDDL INCLUDE MAPPEDThis means that DDL support is now enabled for all tables which have been mapped and in this case it will only apply to the SCOTT.EMP table as that is the only table which is being processed here. We can also use the INCLUDE ALL or EXCLUDE ALL or wildcard characters to specify which tables to enable the DDL support for.GGSCI (redhat346.localdomain) 1> EDIT PARAM EXT1EXTRACT ext1USERID ggs_owner, PASSWORD ggs_ownerRMTHOST 10.53.100.100, MGRPORT 7809RMTTRAIL /u01/oracle/software/goldengate/dirdat/rtDDL INCLUDE MAPPEDTABLE scott.emp;Test the same We will now alter the structure of the EMP table by adding a column and we can see that this new table structure is also reflected on the target system.On SourceSQL> ALTER TABLE EMP ADD NEW_COL VARCHAR2(10);Table altered.On Target SQL> desc empName Null? Type—————————————– ——– —————————-EMPNO NOT NULL NUMBER(4)ENAME VARCHAR2(10)JOB VARCHAR2(20)MGR NUMBER(4)HIREDATE DATESAL NUMBER(7,2)COMM NUMBER(7,2)DEPTNO NUMBER(2)MYCOL VARCHAR2(10)NEW_COL VARCHAR2(10)These errors are characteristic to memory exhaustion problems. Either enough memory is not available on the server, or, the memory is not configured to sustain the Oracle software needs.Please apply the suggested solutions from 'ORA-07445 [ACCESS_VIOLATION] [unable_to_trans_pc] on Windows Platforms (Doc ID 456801.1)'. I will place the SR in monitoring status, waiting for your feedback for 1 week. The ora-7445 mentioned in the note is not mandatory, but the memory issues and the suggestions are valid, so please implement the recommendations.I will follow up with you next Monday, June 20th.Best regards,AdinaGlobal Customer ServicesSolutionPlease refer to Note 342443.1 and apply latest minipack.Have sufficient physical memory on Server so that you can allocate more SGA/PGA to the database.1) Increase SGA_MAX_SIZE and SGA_TARGET so that you can accommodate following pools.2) Restart the instance.3) Increase INIT.ORA memory parameters and make sure following pools are set to recommended value i.e. 200M.a) SHARED_POOL_SIZEb) JAVA_POOL_SIZEc) STREAMS_POOL_SIZEDirecting LogMiner Operations and Retrieving Data of InterestYou direct LogMiner operations using the DBMS_LOGMNR and DBMS_LOGMNR_D PL/SQL packages, and retrieve data of interest using the V$LOGMNR_CONTENTS view, as follows:Specify a LogMiner dictionary.Use the DBMS_LOGMNR_D.BUILD procedure or specify the dictionary when you start LogMiner (in Step 3), or both, depending on the type of dictionary you plan to use.Specify a list of redo log files for analysis.Use the DBMS_LOGMNR.ADD_LOGFILE procedure, or direct LogMiner to create a list of log files for analysis automatically when you start LogMiner (in Step 3).Start LogMiner.Use the DBMS_LOGMNR.START_LOGMNR procedure.Request the redo data of interest.Query the V$LOGMNR_CONTENTS view. (You must have the SELECT ANY TRANSACTION privilege to query this view.)End the LogMiner session.Use the DBMS_LOGMNR.END_LOGMNR procedure.You must have been granted the EXECUTE_CATALOG_ROLE role to use the LogMiner PL/SQL packages and to query the V$LOGMNR_CONTENTS view.Note:When mining a specified time or SCN range of interest within archived logs generated by an Oracle RAC database, you must ensure that you have specified all archived logs from all redo threads that were active during that time or SCN range. If you fail to do this, any queries of V$LOGMNR_CONTENTS will return only partial results (based on the archived logs specified to LogMiner through the DBMS_LOGMNR.ADD_LOGFILE procedure). This restriction is also in effect when you are mining the archived logs at the source database using the CONTINUOUS_MINE option. You should only use CONTINUOUS_MINE on an Oracle RAC database if no thread is being enabled or disabled.DBMS_LOGMNR.ADD_LOGFILEDBMS_LOGMNR_D.BUILDDBMS_LOGMNR.ADD_LOGFILEDBMS_LOGMNR.START_LOGMNRV$LOGMNR_CONTENTSDBMS_LOGMNR.END_LOGMNRCheck in that table st_inward_temp======== Restore from RMAN (Any DB can be used for the same)========399302992110399303211009run{set archivelog destination to '/opt/oracle/admin/RMAN_18082014';restore archivelog from scn 399302992110 until scn 399303211009;}run{set archivelog destination to '/archive/arch/MD1';restore archivelog from scn 4872613932 until scn 4873978397;}run{set archivelog destination to '/opt/oracle/admin/RMAN_18082014/';restore archivelog from sequence until sequence 140580;}run{allocate channel 'T1' type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt.P44)';set archivelog destination to '/u025/';restore archivelog from sequence 140481 until sequence 140580;release channel 'T1';} 2 7194 12-JAN-2014 01:30:061 7855 12-JAN-2014 01:30:061 7856 12-JAN-2014 03:41:5672137873run{allocate channel 'T1' type 'SBT_TAPE' parms 'ENV=(NSR_SERVER=ustlscbu104,NSR_CLIENT=ustsmcdcvtc011,NSR_DATA_VOLUME_POOL=Oracletape)';allocate channel 'T2' type 'SBT_TAPE' parms 'ENV=(NSR_SERVER=ustlscbu104,NSR_CLIENT=ustsmcdcvtc011,NSR_DATA_VOLUME_POOL=Oracletape)';set archivelog destination to '/u115/dbarchive/SGRP/';restore archivelog from sequence 7855 until sequence 7873 thread 1;restore archivelog from sequence 7194 until sequence 7213 thread 2;release channel 'T1';release channel 'T1';}@2025 - 2042cd /u025/gz *.arcscp *.arc.gz bznvjs@ustlsoi011:/u025/arch/TST44scp P44_control_hot_20140511.ctl qz4x1r@ustlsoi011:/home/oracle/rr======== LOG MINING ==================EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/adhocfcdump/rman_bak/rr/1_75430_740933967.dbf');EXECUTE DBMS_LOGMNR.ADD_LOGFILE('/adhocfcdump/rman_bak/rr/2_69405_740933967.dbf');execute DBMS_LOGMNR.START_LOGMNR();create table LOGMNR_rr as select * from V$LOGMNR_CONTENTS where 1 = 2;select * from V$LOGMNR_CONTENTS where upper(seg_name) = upper('st_inward_temp');insert into LOGMNR_rr (select * from V$LOGMNR_CONTENTS where upper(seg_name) = upper('st_inward_temp'));execute DBMS_LOGMNR.END_LOGMNR();=======================================select sid,serial#,SOFAR,TOTALWORK,START_TIME,LAST_UPDATE_TIME,time_remaining from gv$session_longops where sofar <> totalwork;Hi Kindly check the query below / depends on AWR retentioncommand type (7) - deleteSELECT st.executions_total||'--'||SP.SQL_ID||'--'||COST ||'--'||ds.BEGIN_INTERVAL_TIME||'--'||ds.END_INTERVAL_TIMEFROM DBA_HIST_SQL_PLAN SP,DBA_HIST_SQLSTAT ST,DBA_HIST_SNAPSHOT ds WHERE SP.SQL_ID=ST.SQL_ID AND ds.SNAP_ID=ST.SNAP_ID ANDst.executions_total> 1 and cost >1 andto_date(to_char(ds.BEGIN_INTERVAL_TIME,'dd-mm-yyyy hh24:mi'),'dd-mm-yyyy hh24:mi') >= to_date('15-11-2011 13:00','dd-mm-yyyy hh24:mi') and to_date(to_char(ds.BEGIN_INTERVAL_TIME,'dd-mm-yyyy hh24:mi'),'dd-mm-yyyy hh24:mi') <= to_date('15-11-2011 15:00','dd-mm-yyyy hh24:mi')AND SP.SQL_ID IN(SELECT SQL_ID FROM DBA_HIST_SQLTEXT WHERE SQL_ID IN (SELECT distinct SP.SQL_ID FROM DBA_HIST_SQL_PLAN SP,DBA_HIST_SQLSTAT ST,DBA_HIST_SNAPSHOT ds WHERESP.SQL_ID=ST.SQL_ID AND ds.SNAP_ID=ST.SNAP_ID) and COMMAND_TYPE IN (7))ORDER BY st.executions_total,COST,ds.BEGIN_INTERVAL_TIME;RegardsPrasad Joshiselect sid,SQL_HASH_VALUE,opname,sofar,totalwork,round(time_remaining/60,2) time_remain_mins from gv$session_longops where time_remaining >0 order by time_remaining desc;/select sid,SQL_HASH_VALUE,opname,sofar,totalwork,round(time_remaining/60,2) time_remain_mins from gv$session_longops where time_remaining >0 order by time_remaining desc=== Check Session remaining Time.col target for a30col opname for a30col program for a30col event for a40select s.sid,l.opname,l.target,l.sofar,l.totalwork,round(l.time_remaining/60,2) time_remain_mins,l.SQL_HASH_VALUE,s.serial#,s.program,s.event from gv$session_longops l,gv$session swhere s.sid=l.sidand time_remaining >0 and program like '%sqlplus%'order by time_remaining desc;col target for a30col opname for a30col program for a30col event for a40select s.sid,l.opname,l.target,l.sofar,l.totalwork,round(l.time_remaining/60,2) time_remain_mins,l.SQL_HASH_VALUE,s.serial#,s.programfrom gv$session_longops l,gv$session swhere s.sid=l.sidand time_remaining >0 and program like '%sqlplus%'order by time_remaining desc;col target for a30col opname for a30col program for a30col event for a40select s.sid,l.opname,l.target,l.sofar,l.totalwork,round(l.time_remaining/60,2) time_remain_mins,l.SQL_HASH_VALUE,s.serial#,s.program,s.event from v$session_longops l, v$session swhere s.sid=l.sid--and time_remaining >0 and program like '%sqlplus%'order by time_remaining desc;grant select on CASE_INFORMATION to wondersii;AUDIT_TRAILPROPOSALSSTAFFOM_PRDCTSM_MST_GRP_DTLM_BRANCHSLA_BRANCH_MASTER--- STATSPACKsqlplus "/ as sysdba" @?/rdbms/admin/spcreate.sqlconn perfstat/perfstatexec statspack.snap; --- Start SnapShot@?/rdbms/admin/spreport.sql-------------------------------------------------------------------------Installation of the Oracle Statspack tool is a relatively simple process. The following is a step-by-step guide to the process of installing Oracle Statspack on a UNIX system. 1. Navigate to the $ORACLE_HOME/rdbms/admin directory as follows: # cd $ORACLE_HOME/rdbms/admin/ 2. Start the Statspack install script, spcreate.sql, as follows: # sqlplus "/ as sysdba" @spcreate.sql 3. Enter a password for the PERFSTAT user when prompted.4. Enter the default tablespace (tools) for the PERFSTAT user when prompted.5. Enter the temporary tablespace (temp) for the PERFSTAT user when prompted.6. Exit sqlplus as follows: SQL> exitTo collect statistics 1. Connect to the database as the PERFSTAT user as follows: sqlplus perfstat/<password> 2. Create a snapshot with the statspack package as follows: SQL> execute statspack.snap(i_snap_level=>7); 3. Exit SQLPLUS as follows: SQL> exitTo run a Statspack report. 1. Navigate to the $ORACLE_HOME/rdbms/admin directory as follows: # cd $ORACLE_HOME/rdbms/admin/ 2. Run the standard Statspack report as follows: # sqlplus perfstat/<password> @spreport * Enter a beginning snapshot ID.* Enter an ending snapshot ID.* Enter a name for the report or accept the default.* Exit SQLPLUS as follows: SQL> exitRemoving StatspackTo deinstall Statspack, connect as a user with SYSDBA privilege and run the following SPDROP script from SQL*Plus. For example:SQL> CONNECT / AS SYSDBASQL> @?/rdbms/admin/spdropThe SPDROP.SQL script calls the following scripts:SPDTAB.SQL - drops tables and public synonymsSPDUSR.SQL - drops the userCheck each of two output files produced (SPDTAB.LIS, SPDUSR.LIS) to ensure that the package was completely deinstalled.Managing and Sharing Statspack Performance DataThis section discusses the following topics:Sharing Data Through ExportRemoving Unnecessary DataTruncating All Statspack DataSharing Data Through ExportIf you want to share data with other sites (for example, if Oracle Support requires the raw statistics), then you can export the PERFSTAT user. An export parameter file (SPUEXP.PAR) is supplied for this purpose. To use this file, supply the export command with the userid parameter, along with the export parameter file name. For example:exp userid=perfstat/my_perfstat_password parfile=spuexp.parThis creates a file called SPUEXP.DMP and the log file SPUEXP.LOG. If you want to load the data into another database, use the import command.See Also:Oracle9i Database Utilities for more information on using export and importRemoving Unnecessary DataPurge unnecessary data from the PERFSTAT schema using the SPPURGE.SQL script. This deletes snapshots that fall between the begin and end snapshot IDs you specify.Note:You should export the schema as a backup before running this script, either using your own export parameters or those provided in SPUEXP.PAR.Purging can require the use of a large rollback segment, because all data relating to each snapshot ID to be purged is deleted. You can avoid rollback segment extension errors in one of two ways:Specify a smaller range of snapshot IDs to purge.Explicitly use a large rollback segment, by executing the SET TRANSACTION USE ROLLBACK SEGMENT statement before running the SPPURGE.SQL script.See Also:Oracle9i SQL ReferenceWhen you run SPPURGE.SQL, it displays the instance to which you are connected and the available snapshots. It then prompts you for the low snap ID and high snap ID. All snapshots that fall within this range are purged.Example 21-6 Sample Run of SPPURGE.SQLSQL> CONNECT perfstat/my_perfstat_passwordSQL> SET TRANSACTION USE ROLLBACK SEGMENT rbig;SQL> @?/rdbms/admin/sppurge Database Instance currently connected to========================================InstanceDB Id DB Name Inst Num Name----------- ---------- -------- ----------720559826 PERF 1 perf Snapshots for this database instance====================================SnapSnap Id Level Snapshot Started Host Comment---------- ----- --------------------- --------------- -------------------1 5 30 Feb 2000 10:00:01 perfhost2 5 30 Feb 2000 12:00:06 perfhost3 5 01 Mar 2000 02:00:01 perfhost4 5 01 Mar 2000 06:00:01 perfhostCaution:SPPURGE.SQL deletes all snapshots ranging between the lower and upper bound snapshot IDs specified for the database instance connected to. You might want to export this data before continuing.Specify the Low Snap ID and High Snap ID range to purge~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Enter value for losnapid: 1Using 1 for lower bound. Enter value for hisnapid: 2Using 2 for upper bound. Deleting snapshots 1 - 2Purge of specified snapshot range complete. If you want to rollback the purge, it is still possible to do so. Exiting from SQL*Plus automatically commits the purge.SQL> -- end of example outputTo purge in batch mode, you must assign values to the SQL*Plus variables that specify the low and high snapshot IDs to purge. The variables are:LOSNAPID: Begin snapshot IDHISNAPID: End snapshot IDExample 21-7 Running SPPURGE.SQL in Batch ModeSQL> CONNECT perfstat/my_perfstat_passwordSQL> DEFINE losnapid=1SQL> DEFINE hisnapid=2SQL> @?/rdbms/admin/sppurgeWhen SPPURGE.SQL is run, it does not prompt for the information provided by the variables.Truncating All Statspack DataTo truncate all performance data indiscriminately, use SPTRUNC.SQL. This script truncates all statistics data gathered.Note:Oracle Corporation recommends that you export the schema as a backup before running this script, either using your own export parameters or those provided in SPUEXP.PAR.Example 21-8 Sample Run of SPTRUNC.SQLSQL> CONNECT perfstat/my_perfstat_passwordSQL> @?/rdbms/admin/sptrunc~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Note:Running SPTRUNC.SQL removes all data from Statspack tables. You might want to export the data before continuing.If you would like to continue, enter any string, followed by <return>.Enter value for anystring: entered - starting truncate operationTable truncated.<etc>Truncate operation complete.----------------------spool c:\Object_Check_IDB_OUTPUT.txtselect count(*) from dba_objects;select object_type,count(*) from dba_objects group by object_type;select owner,count(*) from dba_objects where status = 'INVALID' group by owner order by 1;select owner,count(*) from dba_objects group by owner;select count(*) from dba_synonyms;select count(*) from dba_queues;spool off;k-- AUDITset head offspool d:\audit_TEST.log;select distinct a from (select 'audit ' || a.privilege || ' by ' || username || ' by access;' afrom dba_users u, (select user_name,privilege from dba_priv_audit_opts) a)order by 1/select distinct a from (select 'noaudit ' || a.privilege || ' by ' || username || ';' afrom dba_users u, (select user_name,privilege from dba_priv_audit_opts where USER_NAME = 'TEST' and privilege like 'CREATE%') awhere u.created like '18-SEP-10')order by 1/select distinct a from (select 'noaudit ' || a.privilege || ' by ' || username || ';' afrom dba_users u, (select user_name,privilege from dba_priv_audit_opts where USER_NAME = 'TEST' and privilege like 'CREATE%') awhere u.created like '18-SEP-10')order by 1/select user_name,privilege from dba_priv_audit_opts where USER_NAME = 'SYS';select user_name,audit_option from dba_stmt_audit_opts where USER_NAME = 'SYS';select ACTION_NAME,username,OWNER,OBJ_NAME,OBJ_PRIVILEGE,EXTENDED_TIMESTAMP from dba_audit_trail where username = 'AMS' order by 6;select ACTION_NAME,username,OWNER,OBJ_NAME,OBJ_PRIVILEGE,EXTENDED_TIMESTAMP from dba_audit_trail where username = 'TESTRR2' order by 6;select user_name,audit_option from dba_stmt_audit_opts where USER_NAME = 'TESTRR';select user_name,privilege from dba_priv_audit_opts where USER_NAME = 'TESTRR';select ACTION_NAME,username,OWNER,OBJ_NAME,OBJ_PRIVILEGE,EXTENDED_TIMESTAMP from dba_audit_trail where order by 6;Auditing is disabled by default, but can enabled by setting the AUDIT_TRAIL static parameter, which has the following allowed values.AUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }The following list provides a description of each setting:•none or false - Auditing is disabled.•db or true - Auditing is enabled, with all audit records stored in the database audit trial (SYS.AUD$).•db,extended - As db, but the SQL_BIND and SQL_TEXT columns are also populated.•xml- Auditing is enabled, with all audit records stored as XML format OS files.•xml,extended - As xml, but the SQL_BIND and SQL_TEXT columns are also populated.•os- Auditing is enabled, with all audit records directed to the operating system's audit trail.Note. In Oracle 10g Release 1, db_extended was used in place of db,extended. The XML options are new to Oracle 10g Release 2.The AUDIT_SYS_OPERATIONS static parameter enables or disables the auditing of operations issued by users connecting with SYSDBA or SYSOPER privileges, including the SYS user. All audit records are written to the OS audit trail.The AUDIT_FILE_DEST parameter specifies the OS directory used for the audit trail when the os, xml and xml,extended options are used. It is also the location for all mandatory auditing specified by the AUDIT_SYS_OPERATIONS parameter.Statement levelAuditing will be done at statement level.Statements that can be audited are found in STMT_AUDIT_OPTION_MAP.SQL> audit table by scott;Audit records can be found in DBA_STMT_AUDIT_OPTS.SQL> select * from DBA_STMT_AUDIT_OPTS;Object levelAuditing will be done at object level.These objects can be audited: tables, views, sequences, packages, stored procedures and stored functions.SQL> audit insert, update, delete on scott.emp by hr;Audit records can be found in DBA_OBJ_AUDIT_OPTS.SQL> select * from DBA_OBJ_AUDIT_OPTS;Privilege levelAuditing will be done at privilege level.All system privileges that are found in SYSTEM_PRIVILEGE_MAP can be audited.SQL> audit create tablespace, alter tablespace by all;Specify ALL PRIVILEGES to audit all system privileges.Audit records can be found in DBA_PRIV_AUDIT_OPTS.SQL> select * from DBA_PRIV_AUDIT_OPTS;SELECT_PRIVINSERT_PRIVDELETE_PRIVUPDATE_PRIVREFERENCES_PRIVALTER_PRIVINDEX_PRIVaudit grant on test.test1 by access;noaudit grant on test.test1;select ACTION_NAME,username,OWNER,grantee,OBJ_NAME,OBJ_PRIVILEGE from dba_audit_trail username = 'RONAK';Obj_Privilege has below 16 Audit Trail Grants Systems, There is 16 (-) Hifns which means Grants.HiPNS:1 - ALTER2 - 3 - 4 - DELETE5 - 6 - 7 - INSERT 8 - 9 - 10 - SELECT11 - UPDATE12 - 13 - 14 - 15 - 16 - grant insert,update,delete on test1 to rr;---Y--Y---Y-----audit alter any trigger by test by access;AUDIT GRANT PROCEDURE BY USER; AUDIT GRANT DIRECTORY AUDIT GRANT SEQUENCE AUDIT GRANT TABLE AUDIT GRANT TYPE AUDIT ROLE select 'grant '|| PRIVILEGE || ' on ' || table_name || ' to ' || grantee from DBA_TAB_PRIVS where grantee like 'WONUAT';select 'grant '|| PRIVILEGE || ' on ' || table_name || ' to CP;' from DBA_TAB_PRIVS where owner like 'BLTS';select 'grant '|| PRIVILEGE || ' on ' || table_name || ' to || grantee ||';' from DBA_TAB_PRIVS where table_name in (select table_name from dba_external_tables);ams_rate_master 10 - 144SQL> select SQL_TEXT from v$sqltext where HASH_VALUE='3783944380' order by PIECE;SQL_TEXT----------------------------------------------------------------SELECT DECODE(MDCG.DCMNT_CTGRY_CD,NULL,0, MDCG.DCMNT_CTGRY_CD) ,DT.DCMNT_TYP_CD , DT.DSPLY_TXT, DECODE(NBD.DCMNT_TYP_CD,NULL,'','CHECKED') CHKSEQ, MWD.REQUIRED_YN FROM DCMNT_TYPS DT, NB_DCMNTS NBD, M_WD_DCMNTS MWD, M_DCMNT_CTGRY_GRP_MAP MDCG WHERE NBD.NB_REF_NO(+) = :B3 AND NBD.DCMNT_TYP_CD(+) = DT.DCMNT_TYP_CD AND MWD.WD_DCMNT_GRP_CD = :B2 AND MWD.DCMNT_TYP_CD = DT.DCMNT_TYP_CD AND MWD.DCMNT_TYP_CD = MDCG.DCMNT_TYP_CD(+) AND MWD.DELETE_YN = :B1 AND DT.DELETE_YN = :B1 ORDER BY MWD.DSPLY_SEQ, DT.DSPLY_TXTvijay gokaameya kulvinayak sawantsupratim chaudh=== Archive Check in Hoursselect to_char(first_time,'YYYY-MON-DD') day,to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'99') "00",to_char(sum(decode(to_char(first_time,'HH24'),'01',1,0)),'99') "01",to_char(sum(decode(to_char(first_time,'HH24'),'02',1,0)),'99') "02",to_char(sum(decode(to_char(first_time,'HH24'),'03',1,0)),'99') "03",to_char(sum(decode(to_char(first_time,'HH24'),'04',1,0)),'99') "04",to_char(sum(decode(to_char(first_time,'HH24'),'05',1,0)),'99') "05",to_char(sum(decode(to_char(first_time,'HH24'),'06',1,0)),'99') "06",to_char(sum(decode(to_char(first_time,'HH24'),'07',1,0)),'99') "07",to_char(sum(decode(to_char(first_time,'HH24'),'08',1,0)),'99') "08",to_char(sum(decode(to_char(first_time,'HH24'),'09',1,0)),'99') "09",to_char(sum(decode(to_char(first_time,'HH24'),'10',1,0)),'99') "10",to_char(sum(decode(to_char(first_time,'HH24'),'11',1,0)),'99') "11",to_char(sum(decode(to_char(first_time,'HH24'),'12',1,0)),'99') "12",to_char(sum(decode(to_char(first_time,'HH24'),'13',1,0)),'99') "13",to_char(sum(decode(to_char(first_time,'HH24'),'14',1,0)),'99') "14",to_char(sum(decode(to_char(first_time,'HH24'),'15',1,0)),'99') "15",to_char(sum(decode(to_char(first_time,'HH24'),'16',1,0)),'99') "16",to_char(sum(decode(to_char(first_time,'HH24'),'17',1,0)),'99') "17",to_char(sum(decode(to_char(first_time,'HH24'),'18',1,0)),'99') "18",to_char(sum(decode(to_char(first_time,'HH24'),'19',1,0)),'99') "19",to_char(sum(decode(to_char(first_time,'HH24'),'20',1,0)),'99') "20",to_char(sum(decode(to_char(first_time,'HH24'),'21',1,0)),'99') "21",to_char(sum(decode(to_char(first_time,'HH24'),'22',1,0)),'99') "22",to_char(sum(decode(to_char(first_time,'HH24'),'23',1,0)),'99') "23"from v$log_historywhere to_char(first_time,'YYYY') = 2010 and to_char(first_time,'MM') = 10group by to_char(first_time,'YYYY-MON-DD') order by 1;=== Recover Until TimeSQL> select 'recover standby database until time ''' || to_char(sysdate,'yyyy-mm-dd') || ':00:05:00'';' from dual;SQL> recover standby database until time '2010-05-22:11:59:00';SQL> select name,to_char(CHECKPOINT_TIME,'dd-mm-yyyy hh24:mi:ss') from v$datafile;SQL> select thread#,sequence#,to_char(first_time,'DD-MON-YYYY HH24:MI:SS') from v$log_history where sequence# in (select max(sequence#) from v$log_history group by thread#);recover database using backup controlfile until time '2011-10-16:12:00:00';8 rows selected.SQL> select username,schemaname,program,sid,serial# from v$session where sid=2896;USERNAME SCHEMANAME PROGRAM SID SERIAL#---------- ------------ ---------------------------------------------------------------- ---------- ----------WONDERSII WONDERSII w3wp.exe 2896 60SQL> select username,schemaname,program,sid,serial#,machine from v$session where sid=2896;USERNAME SCHEMANAME PROGRAM SID SERIAL# MACHINE---------- ------------ ---------------------------------------------------------------- ---------- ---------- ---------------WONDERSII WONDERSII w3wp.exe 2896 60 HDFCSLDM\VMWONDERSWEB5OBJ$WRI$_ADV_OBJECTSWRI$_ADV_OBJSPACE_TREND_DATAWRI$_SEGADV_OBJLIST -- VIP TableSYS.WRH$_SQLTEXT SYS.WRH$_SQL_PLAN SYS.WRI$_ADV_ACTIONS SYS.WRI$_ADV_OBJECTS SYS.WRI$_ADV_RATIONALESYS.WRI$_DBU_FEATURE_METADATASYS.WRI$_DBU_FEATURE_USAGE SYS.WRI$_DBU_HWM_METADATA SELECT snap_id, startup_time FROM dba_hist_snapshot ORDER BY 1,2;oracle - EXP--- This table is getting Used by Export to Take export. In Oracle 11g this table is having 1 more Column POLYTYP, that is the reason Export not working from Oracle 11G to Oracle 10G.SQL> desc EXU9RLSName Null? Type----------------------------------------- -------- ----------------------------OBJOWN NOT NULL VARCHAR2(30)OBJNAM NOT NULL VARCHAR2(30)POLGRP NOT NULL VARCHAR2(30)POLICY NOT NULL VARCHAR2(30)POLOWN NOT NULL VARCHAR2(30)POLSCH VARCHAR2(30)POLFUN NOT NULL VARCHAR2(30)STMT VARCHAR2(28)CHKOPT NOT NULL NUMBERENABLED NOT NULL NUMBERSPOLICY NUMBERselect inst_id,sid,serial#,program,event,action,machine,terminal,p1,p2,p3,schemaname from gv$session where sid=633;select OPEN_RESETLOGS,DATABASE_ROLE,PLATFORM_NAME,SWITCHOVER_STATUS from v$database;office 123,kesar resi.,above bhagwati hotel,charkop,VARIABLE jobno number;BEGINDBMS_JOB.SUBMIT(:jobno, 'begin rr_update_resource_master; commit; end;',SYSDATE, 'SYSDATE + 120/1440');commit;END;/print jobnoselect log_user,what,job,broken,FAILURES,TOTAL_TIME,to_char(next_date,'dd-mm-yyyy hh24:mi:ss'),to_char(this_date,'dd-mm-yyyy hh24:mi:ss'),to_char(last_date,'dd-mm-yyyy hh24:mi:ss') from dba_jobs where job=81;--upper(what) like '%AMS_PKG_UDAAN_DCHANNEL.AMS_SP_HIBERNATE_JOB%';select log_user,what,job,broken,FAILURES,TOTAL_TIME,to_char(next_date,'dd-mm-yyyy hh24:mi:ss'),to_char(this_date,'dd-mm-yyyy hh24:mi:ss') from dba_jobs where job=1703;col what for a60col next_date for a20col last_date for a20select log_user,what,job,broken,FAILURES,TOTAL_TIME,to_char(next_date,'dd-mm-yyyy hh24:mi:ss') Next_Date,to_char(last_date,'dd-mm-yyyy hh24:mi:ss') Last_date,interval from dba_jobs WHERE upper(what) like '%CREATE_REJTXNRPT%';broken = 'Y';job=1703;IN (76268,76269,76270);col log_user for a10col what for a60col next_date for a20col last_date for a20select log_user,job,broken,FAILURES,TOTAL_TIME,to_char(next_date,'dd-mm-yyyy hh24:mi:ss') Next_Date,to_char(last_date,'dd-mm-yyyy hh24:mi:ss') Last_date,interval from dba_jobs where last_date like sysdate;WHERE job=1783;VARIABLE jobno number;BEGINDBMS_JOB.SUBMIT(:jobno, 'begin pclmmed.SP_INSTTMEDCLM; end;',SYSDATE,'SYSDATE + 120/1440');commit;END;/print jobnobegindbms_job.change(755,'begin etl.pk_job_controller.sp_run_group(''CP-Daily-Schedulers''); end;',trunc(sysdate)+1,'trunc(sysdate)+1+8/24');commit;end;/exec dbms_job.next_date(755, SYSDATE + 11.5/24); VARIABLE jobno number;BEGINDBMS_JOB.SUBMIT(:jobno, 'begin etl.pk_job_controller.sp_run_group(''CP-Daily-Schedulers''); end;',SYSDATE+1,'SYSDATE + 120/1440');commit;END;/print jobnoNOTE :- To stop a JOB in DBA_JOBS. 1st Disable DBA_JOB & then kill session. The only way to stop DBA_JOBSBEGINDBMS_JOB.change(444, 'begin PRL_PKG_EXTERNAL_UPLOADS.sp_update_resource_master; commit; end;',SYSDATE+120/1440, 'SYSDATE+180/1440');commit;END;exec DBMS_JOB.run(464);BEGINDBMS_JOB.REMOVE(6865);COMMIT;END; BEGINDBMS_JOB.REMOVE(19718);COMMIT;END; BEGINDBMS_IJOB.REMOVE(27192);COMMIT;END; /BEGINDBMS_JOB.broken(28730,TRUE);COMMIT;END; /BEGINDBMS_JOB.REMOVE(28730);COMMIT;END; LOG_USER------------------------------WHAT------------------------------------------------------------------------------------------------------------------JOB B FAILURES TOTAL_TIME TO_CHAR(NEXT_DATE,' TO_CHAR(THIS_DATE,'---------- - ---------- ---------- ------------------- -------------------HSLRNRPRODEOD_UPD_INFC.PROCESS_FILE('001','BASE','SALES','220','cmanil',TO_DATE('22.06.2012', 'dd.MM.yyyy')) ;19718 N 9 400 23-06-2012 17:01:07BEGINDBMS_JOB.REMOVE(51);COMMIT;END; BEGINDBMS_JOB.REMOVE(2);COMMIT;END; BEGINDBMS_JOB.REMOVE(24);COMMIT;END; EXEC DBMS_JOB.BROKEN(2670,TRUE);EXEC DBMS_JOB.BROKEN(2670,TRUE);EXEC DBMS_JOB.BROKEN(519,TRUE);EXEC DBMS_JOB.BROKEN(520,TRUE);EXEC DBMS_JOB.BROKEN(3208,TRUE);EXEC DBMS_JOB.BROKEN(3196,TRUE);EXEC DBMS_JOB.BROKEN(51309,TRUE);EXEC DBMS_JOB.BROKEN(51644,TRUE);exec DBMS_JOB.run(3);BEGINDBMS_JOB.change(3, 'viking.viking1',SYSDATE+20/1440, 'SYSDATE+180/1440');commit;END;VARIABLE jobno number;BEGINDBMS_JOB.SUBMIT(:jobno, 'viking.viking1;',SYSDATE+20/1440,'SYSDATE + 120/1440');commit;END;/print jobno======= DIRECTORIES / DATAPMP ================CREATE OR REPLACE DIRECTORY test_dir AS '/u01/app/oracle/oradata/';GRANT READ, WRITE ON DIRECTORY test_dir TO scott;expdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=expdpEMP_DEPT.log SCHEMAS=SCOTT,HR,ALIimpdp scott/tiger@db10g tables=EMP,DEPT directory=TEST_DIR dumpfile=EMP_DEPT.dmp logfile=impdpEMP_DEPT.logCREATE OR REPLACE DIRECTORY datapmp_exp AS 'd:\datapmp_exp';GRANT READ, WRITE ON DIRECTORY datapmp_exp to system;set oracle_sid=hdfcprod2expdp system/oracle directory=datapmp_exp dumpfile=expdp_FULL_19082010_%u.dmp logfile=expdp_FULL_24092010.log full=y filesize=25Gset oracle_sid=hdfcamhimpdp system/oracle directory=DATAPMP_EXP dumpfile=expdp_FULL_19082010_%u.dmp logfile=IMP_AMS_TAB_01092010.log--- DataPMP Script ---for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (set fDate=DATAPMP_exphdfcprod_%%j%%k%%l)echo -+++++++++++++++++++++++- EXPORT log -+++++++++++++++++++++++->> D:\datapmp_exp\logs\Datapmp_HDFCPRODEXP.LogDel D:\datapmp_exp\*.* /q >> D:\datapmp_exp\logs\Datapmp_HDFCPRODEXP.Logset oracle_sid=hdfcprodexpdp system/oracle directory=datapmp_exp dumpfile=%fdate%.dmp logfile=%fdate%.logecho -+++++++++++++++++++++++- EXPORT log -+++++++++++++++++++++++- >> D:\datapmp_exp\logs\Datapmp_HDFCPRODEXP.Logexit---- Datapmp Example -----move E:\datapmp_exp\EXPDP_PRL_Sys_1.dmp E:\datapmp_exp\EXPDP_PRL_Sys_1_Prev.dmpmove E:\datapmp_exp\EXPDP_PRL_Sys_1.log E:\datapmp_exp\EXPDP_PRL_Sys_1_Prev.logset oracle_sid=prlprodexpdp system/oracle directory=datapmp_exp dumpfile=expdp_PRL_Sys_1.dmp logfile=expdp_PRL_Sys_1.log tables=prl_prod.PRL_CASE_AUDIT_TRAIL EXCLUDE=STATISTICS,CONSTRAINT,TRIGGER query=\"WHERE PCAT_CR_DT like sysdate - 1\"xcopy E:\Datapmp_exp\EXPDP_PRL_Sys_1.dmp z:\xcopy E:\Datapmp_exp\EXPDP_PRL_Sys_1.log z:\move D:\datapmp_exp\impdp_PRL_Sys_1.log D:\datapmp_exp\impdp_PRL_Sys_1_Prev.logset oracle_sid=hdfcprod2impdp system/oracle directory=datapmp_exp dumpfile=expdp_PRL_Sys_1.dmp logfile=impdp_PRL_Sys_1.log tables=PRL_CASE_AUDIT_TRAIL remap_schema=prl_prod:SAM_NEW remap_tablespace=TBS_PRL_PROD:AMS_TRANSACTION_DATA remap_tablespace=TBS_PRL_PROD_INDX:INDX TABLE_EXISTS_ACTION=appenddel D:\datapmp_exp\EXPDP_PRL_SYS_1.*SELECT a.sid, c.pid, c.spid, a.username, b.event, b.wait_time, b.seconds_in_wait, b.p1, b.p2, b.p3FROM v$session a, v$session_wait b, v$process c WHERE a.sid = b.sid AND a.paddr = c.addr AND b.event LIKE 'enq: RO%' ;018023289Paras Query:Large:set lines 200set pages 9999col logon for a20col client_info for a30col status for a10col program for a30col event for a30col username for a15col running_since for a20selecta.inst_id,a.sid,a.program,a.event,a.username,a.status,a.sql_hash_value,to_char(logon_time,'dd-mm-yy hh:mi:ss') "LOGON",floor(last_call_et/3600)||':'||floor(mod(last_call_et,3600)/60)||':'||mod(mod(last_call_et,3600),60) "RUNNING_SINCE"fromgv$session awherea.type='USER'AND floor(last_call_et/3600)*60+floor(mod(last_call_et,3600)/60) > 5AND a.STATUS = 'ACTIVE'AND a.SID > 10order by a.last_call_et;set lines 200set pages 9999col logon for a20col client_info for a30col status for a10col program for a30col event for a30col username for a15col running_since for a20selecta.inst_id,a.sid,a.program,a.event,a.username,a.status,a.sql_hash_value,to_char(logon_time,'dd-mm-yy hh:mi:ss') "LOGON",floor(last_call_et/3600)||':'||floor(mod(last_call_et,3600)/60)||':'||mod(mod(last_call_et,3600),60) "RUNNING_SINCE",last_call_etfromgv$session awherea.type='USER'AND floor(last_call_et/3600)*60+floor(mod(last_call_et,3600)/60) > 2AND a.STATUS = 'ACTIVE'AND a.SID > 10order by a.last_call_et;select sql_text from v$sqltext where HASH_VALUE='&HASH_VALUE' order by piece;37862382371439292066224658237select sid,serial#,program,event,last_call_et,floor(last_call_et/3600)*60+floor(mod(last_call_et,3600)/60) from v$session where schemaname not like 'SYS';select sql_text from v$sqltext where HASH_VALUE='&HASH_VALUE' order by piece;select decode(lob.kglobtyp, 0, 'NEXT OBJECT', 1, 'INDEX', 2, 'TABLE', 3, 'CLUSTER',4, 'VIEW', 5, 'SYNONYM', 6, 'SEQUENCE',7, 'PROCEDURE', 8, 'FUNCTION', 9, 'PACKAGE',11, 'PACKAGE BODY', 12, 'TRIGGER',13, 'TYPE', 14, 'TYPE BODY',19, 'TABLE PARTITION', 20, 'INDEX PARTITION', 21, 'LOB',22, 'LIBRARY', 23, 'DIRECTORY', 24, 'QUEUE',28, 'JAVA SOURCE', 29, 'JAVA CLASS', 30, 'JAVA RESOURCE',32, 'INDEXTYPE', 33, 'OPERATOR',34, 'TABLE SUBPARTITION', 35, 'INDEX SUBPARTITION',40, 'LOB PARTITION', 41, 'LOB SUBPARTITION',42, 'MATERIALIZED VIEW',43, 'DIMENSION',44, 'CONTEXT', 46, 'RULE SET', 47, 'RESOURCE PLAN',48, 'CONSUMER GROUP',51, 'SUBSCRIPTION', 52, 'LOCATION',55, 'XML SCHEMA', 56, 'JAVA DATA',57, 'SECURITY PROFILE', 59, 'RULE',62, 'EVALUATION CONTEXT','UNDEFINED') object_type,lob.KGLNAOBJ object_name,pn.KGLPNMOD lock_mode_held,pn.KGLPNREQ lock_mode_requested,ses.sid,ses.serial#,ses.usernameFROMx$kglpn pn,v$session ses,x$kglob lob,v$session_wait vswWHEREpn.KGLPNUSE = ses.saddr andpn.KGLPNHDL = lob.KGLHDADRand lob.kglhdadr = vsw.p1rawand vsw.event like '%free%'order by lock_mode_held desc;select sid,serial#,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi'),sql_hash_value from gv$session where sid=266;set lines 200set pages 200col event for a40col program for a30col inst_id for 99col serial# for 999999select inst_id,sid,serial#,event,program,action,sql_hash_value,to_char(logon_time,'dd-mm-yyyy hh24:mi'),client_info from gv$session where (event like '%free%' or event like '%local%' or event like '%local%') order by sql_hash_value,logon_time;select SQL_TEXT from v$sqltext where HASH_VALUE='3114014027' order by PIECE;set lines 200set pages 200col event for a40col program for a30col inst_id for 99col serial# for 999999col Logon_Time for a20select inst_id,sid,serial#,event,program,action,sql_hash_value,to_char(logon_time,'dd-mm-yyyy hh24:mi') Logon_time,client_info from gv$session where sid in (select distinct session_id from gv$locked_object) order by logon_time;Hdfc Bank Customer Support - 61606161explain plan for SELECT f_docnumber,f_docclassnumber,f_entrydate,f_archivedate,f_deletedate,f_retentbase,f_retentdisp,f_retentoffset,f_pages,f_doctype,f_accessrights,f_docformat,f_doclocation,f_ce_os_id,f_accessrights_rd,f_accessrights_wr,f_accessrights_ax,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a70,a71 FROM f_sw.doctaba WHERE f_docnumber = 29683505;@?/rdbms/admin/utlxpls.sql======= SCHEDULER JOBS =============SELECT name FROM dba_dependenciesWHERE referenced_name = 'DBMS_SCHEDULER'UNIONSELECT referenced_name FROM dba_dependenciesWHERE name = 'DBMS_SCHEDULER'; col owner for a12col JOB_ACTION for a50select owner,job_name,state,job_type,job_action,run_count,to_char(LAST_RUN_DURATION,'dd-mm-yyyy hh24:mi:ss'),to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),to_char(LAST_START_DATE,'dd-mm-yyyy hh24:mi:ss'),failure_count from dba_scheduler_jobs where upper(JOB_action) like '%CREATE_REJTXNRPT%';EXEC DBMS_STATS.gather_table_stats('PRL_PROD', 'RESOURCE_MASTER_MIRROR');EXEC DBMS_STATS.gather_table_stats('FLEXPROD_HOST', 'CH_ACCT_CUST_XREF_AUDIT', cascade => true);col owner for a12col JOB_ACTION for a50select owner,job_name,state,enabled,REPEAT_INTERVAL,job_type,job_action,run_count,to_char(LAST_RUN_DURATION,'dd-mm-yyyy hh24:mi:ss'),to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),to_char(LAST_START_DATE,'dd-mm-yyyy hh24:mi:ss'),failure_count from dba_scheduler_jobs where JOB_NAME like '%AGENT%';col owner for a12col JOB_ACTION for a50select owner,job_name,state,job_type,job_action,run_count,to_char(LAST_RUN_DURATION,'dd-mm-yyyy hh24:mi:ss'),to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),to_char(LAST_START_DATE,'dd-mm-yyyy hh24:mi:ss'),failure_count from dba_scheduler_jobs where JOB_NAME like '%Mat_View%';select owner,job_name,to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),JOB_ACTION from dba_scheduler_jobs where job_name like '%SP_WONDERS_DATA_CHECK%';UPDATE_MEDICAL_FOR_CLIAMS SCHEDULED EXECUTABLE BEGIN pclmmed.SP_INSTTMEDCLM; END;SET LONG 100000SELECT DBMS_METADATA.get_ddl('PROCOBJ','MY_TEST_JOB', 'TEST') AS job_def FROM dual;SET LONG 100000SELECT DBMS_METADATA.get_ddl('PROCOBJ',JOB_NAME, owner) AS job_def FROM dba_scheduler_jobs where job_name = 'AMS_PKG_WALLET_LEADS_JOB' and owner = 'AMS';begindbms_scheduler.drop_job(job_name => 'prl_prod.Mat_View_Refersh');end;/begindbms_scheduler.create_job(job_name => 'prl_prod.Mat_View_Refersh',job_type => 'PLSQL_BLOCK',job_action => 'BEGIN DBMS_SNAPSHOT.REFRESH(LIST => ''PRL_PROD.PRL_MVIEW_DMC_INW_TAT_DET_REP'',PUSH_DEFERRED_RPC => TRUE,REFRESH_AFTER_ERRORS => FALSE,PURGE_OPTION => 1,PARALLELISM => 0,ATOMIC_REFRESH => TRUE,NESTED => FALSE); END;',start_date => TO_DATE('10/23/2012 06:00 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Mat View Referesh');end;/wondersii.PRC_NEW_COMP_SMS_1;begindbms_scheduler.create_job(job_name => 'WONDERSII.PRC_NEW_COMP_SMS',job_type => 'PLSQL_BLOCK',job_action => 'begin wondersii.PRC_NEW_COMP_SMS_1; wondersii.PRC_NEW_COMP_SMS_2; end;',start_date => TO_DATE('10/04/2012 07:00 AM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Send SMS PRC_NEW_COMP_SMS_1 N 2');end;/GP.GP_UNIT_STMT_PKG.SP_EXT_UNIT_STMTS;rrrrbegindbms_scheduler.create_job(job_name => 'GP.GP_UNIT_STMT',job_type => 'PLSQL_BLOCK',job_action => 'begin GP.GP_UNIT_STMT_PKG.SP_EXT_UNIT_STMTS; end;',start_date => TO_DATE('11/21/2012 07:00 AM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',enabled => true,comments => 'GP.GP_UNIT_STMT_PKG.SP_EXT_UNIT_STMTS');end;/begindbms_scheduler.create_job(job_name => 'prl_prod.AMS_AGENT_DATA_UPLOAD',job_type => 'PLSQL_BLOCK',job_action => 'begin prl_prod.prl_pkg_external_uploads.sp_update_agent_master; commit; end;',start_date => TO_DATE('05/26/2012 09:00 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=MINUTELY; INTERVAL=360',enabled => true,comments => 'External Upload rr2');end;begindbms_scheduler.create_job(job_name => 'wondersii.UPDATE_MEDICAL_FOR_CLIAMS',job_type => 'PLSQL_BLOCK',job_action => 'begin wondersii.pclmmed.SP_INSTTMEDCLM; end;',start_date => TO_DATE('10/30/2010 09:30 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Update Medical for Claim');end;/begindbms_scheduler.create_job(job_name => 'HSLRNRPROD.EOD_AgreementClosure_SJOB',job_type => 'PLSQL_BLOCK',job_action => 'begin HSLRNRPROD.EOD_AgreementClosure(''001'',''100'',get_businessdate(''001''),''SYSTEM'',NULL); end;',start_date => TO_DATE('09/13/2012 02:00 AM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'EOD Agreement JOB');end;/begindbms_scheduler.create_job(job_name => 'ams.AMS_SP_CHANGE_REQUEST_SJOB',job_type => 'PLSQL_BLOCK',job_action => 'begin ams.AMS_SP_CHANGE_REQUEST; end;',start_date => TO_DATE('09/13/2012 10:30 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Executing AMS_SP_CHANGE_REQUEST');end;/begindbms_scheduler.create_job(job_name => 'CP.PK_CONTROLLER_JOB',job_type => 'PLSQL_BLOCK',job_action => 'begin ETL.PK_JOB_CONTROLLER.sp_run_group(''CP Daily Extraction''); ETL.PK_JOB_CONTROLLER.sp_run_group(''Purge Unit Statements''); end;',start_date => TO_DATE('08/07/2012 03:00 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Execute ETL Controller Job');end;/begindbms_scheduler.create_job(job_name => 'GP.PK_CONTROLLER_JOB',job_type => 'PLSQL_BLOCK',job_action => 'begin ETL.PK_JOB_CONTROLLER.sp_run_group(''GP-Daily Extraction''); END;',start_date => TO_DATE('08/31/2012 03:10 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Execute ETL Controller Job');end;/begin dbms_scheduler.drop_job(job_name => 'GP.PK_CONTROLLER_JOB'); end;/BEGIN -- Job defined by existing schedule and inline program. DBMS_SCHEDULER.create_job ( job_name => 'PRL_PROD.JOB_UPDATE_RESOURCE_MASTER',job_type => 'PLSQL_BLOCK',job_action => 'BEGIN PRL_PROD.rr_UPDATE_RESOURCE_MASTER; COMMIT; END;',start_date => TO_DATE('10/20/2012 08:00 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=MINUTELY; INTERVAL=20',enabled => TRUE ,comments => 'Job defined by existing schedule and inline program.'); END; /=======================================EXECUTING EXECUTABLE from Scheduler JOBSNeed to start JOB Scheduler Service from Services.mscselect status, error#, substr(additional_info,1,500) from user_scheduler_job_run_details where job_name = 'EXP_MDEALING';begindbms_scheduler.create_job(job_name => 'SYSTEM.EXP_MDEALUAT',job_type => 'EXECUTABLE',job_action => 'D:\BKP_Test\MFundMcy.bat',repeat_interval => 'FREQ=DAILY',enabled => FALSE,comments => 'Exp Backup to D:\BKP_Test\MFundMcy.bat');end;/exp sys/sys@neft_khr filename=E:\shaik\ABC.dmp logfile=E:\shaik\ABC.log rows=Nselect username,owner,obj_name,action_name,timestamp from dba_audit_trail where obj_name like upper('%ap_sp_get%') order by 5;col owner for a12col JOB_ACTION for a50select owner,job_name,state,job_type,job_action,run_count,to_char(LAST_RUN_DURATION,'dd-mm-yyyy hh24:mi:ss'),to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),to_char(LAST_START_DATE,'dd-mm-yyyy hh24:mi:ss'),failure_count from dba_scheduler_jobs where JOB_NAME like '%AMS_PKG_POLICY%';BeginDbms_scheduler.set_attribute(name => 'AMS.LTS_LEADS_SUMMARY_CALC_MERGE',attribute => 'repeat_interval',value => 'FREQ=DAILY;BYHOUR=9;BYMINUTE=0;BYSECOND=0');End;/BeginDbms_scheduler.set_attribute(name => 'AMS.AMS_PKG_UNIT_STATEMENT',attribute => 'repeat_interval',value => 'FREQ=WEEKLY; BYDAY=MON; BYHOUR=18; BYMINUTE=14;');End;/BeginDbms_scheduler.set_attribute(name => 'wondersii.PRC_NEW_COMP_SMS',attribute => 'repeat_interval',value => 'FREQ=DAILY;BYHOUR=21;BYMINUTE=20;BYSECOND=0');End;/FREQ=WEEKLY; BYDAY=TUE; BYHOUR=11; BYMINUTE=24;BEGIN -- Job defined by existing schedule and inline program. DBMS_SCHEDULER.create_job ( job_name => 'AMS.TEST_TRUNCATE',job_type => 'PLSQL_BLOCK',job_action => 'BEGIN ams.RR_PKG; END;',start_date => TO_DATE('12/22/2011 09:45 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => TRUE ,comments => 'AMS.TEST_TRUNCATE'); END; /select EXEC DBMS_SCHEDULER.DROP_JOB('AMS.TEST_TRUNCATE3');EXEC DBMS_SCHEDULER.DROP_JOB('AMS.TEST_TRUNCATE');exec DBMS_SCHEDULER.RUN_JOB('AMS.TEST_TRUNCATE');exec DBMS_SCHEDULER.RUN_JOB('WONDERSII.PRC_NEW_COMP_SMS');EXEC DBMS_SCHEDULER.DROP_JOB('CP.PK_CONTROLLER_JOB');insert into ams.AMS_USAGE_DETAIL_PZ_BKPPP (select * from ams.AMS_POLICY_DETAILS);commit;exec DBMS_SCHEDULER.RUN_JOB('AMS.TEST_TRUNCATE');create or replace procedure ams.rr_PKG isbeginEXECUTE IMMEDIATE 'TRUNCATE TABLE AMS_USAGE_DETAIL_PZ_BKPPP';End rr_PKG;/beginEXECUTE IMMEDIATE 'TRUNCATE TABLE AMS_USAGE_DETAIL_PZ_BKPPP';end;/create table ams.AMS_USAGE_DETAIL_PZ_BKPPP as (select * from ams.AMS_POLICY_DETAILS);drop table ams.AMS_USAGE_DETAIL_PZ_BKPPP;select count(*) from ams.AMS_USAGE_DETAIL_PZ_BKPPP;insert into ams.AMS_USAGE_DETAIL_PZ_BKPPP (select * from ams.AMS_POLICY_DETAILS);commit;exec DBMS_SCHEDULER.RUN_JOB('AMS.TEST_TRUNCATE');SQL> insert into ams.AMS_USAGE_DETAIL_PZ_BKPPP (select * from ams.AMS_POLICY_DETAILS);4566350 rows created.Elapsed: 00:01:33.76SQL> commit;Commit complete.Elapsed: 00:00:00.14SQL> exec DBMS_SCHEDULER.RUN_JOB('AMS.TEST_TRUNCATE');PL/SQL procedure successfully completed.Elapsed: 00:00:55.96SQL>====================================begindbms_scheduler.create_job(job_name => 'ARC_MOVE_3',job_type => 'EXECUTABLE',job_action => '/home/arup/dbtools/move_arcs.sh',repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',enabled => true,comments => 'Move Archived Logs to a Different Directory');end;/begindbms_scheduler.create_job(job_name => 'ARC_MOVE_3',job_type => 'EXECUTABLE',job_action => '/home/arup/dbtools/move_arcs.sh',repeat_interval => 'FREQ=MINUTELY; INTERVAL=30',enabled => true,comments => 'Move Archived Logs to a Different Directory');end;/begindbms_scheduler.create_job(job_name => 'WONDERSII.UPDATE_MEDICAL_FOR_CLIAMS',job_type => 'EXECUTABLE',job_action => 'BEGIN WONDERSII.PCLMMED.SP_INSTTMEDCLM; END;',start_date => TO_DATE('10/18/2010 09:30 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Update Medical for Claim');end;/begindbms_scheduler.create_job(job_name => 'IDEAS.JOB_IDEAS_UPDATE_BUSINESSDATE',job_type => 'PLSQL_BLOCK',job_action => 'BEGIN IDEAS.IDEAS_UPDATE_BUSINESSDATE; COMMIT; END;',start_date => TO_DATE('11/13/2010 01:00 AM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'IDEAS_UPDATE_BUSINESSDATE');end;/begindbms_scheduler.create_job(job_name => 'wondersii.UPDATE_MEDICAL_FOR_CLIAMS',job_type => 'PLSQL_BLOCK',job_action => 'begin wondersii.pclmmed.SP_INSTTMEDCLM; end;',start_date => TO_DATE('10/30/2010 09:45 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=DAILY',enabled => true,comments => 'Update Medical for Claim');end;/begindbms_scheduler.create_job(job_name => 'JOB_SP_WONDERS_DATA_CHECK',job_type => 'EXECUTABLE',job_action => 'begin WONDERSII.SP_WONDERS_DATA_CHECK; end;',start_date => TO_DATE('08/25/2010 4:21 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'freq=daily;byhour=6;byminute=30;bysecond=0',enabled => true,comments => 'Executes SP_WONDERS_DATA_CHECK Proc. daily at 6:30 AM');end;/BEGIN -- Job defined by existing schedule and inline program. DBMS_SCHEDULER.create_job ( job_name => 'IDEAS.JOB_IDEAS_UPLOAD_RECEIPT',job_type => 'PLSQL_BLOCK',job_action => 'BEGIN IDEAS.IDEAS_UPLOAD_RECEIPT; COMMIT; END;',start_date => TO_DATE('04/14/2011 09:05 PM','mm/dd/yyyy hh12:mi AM'),repeat_interval => 'FREQ=MINUTELY; INTERVAL=180',enabled => TRUE ,comments => 'Job defined for IDEAS Upload Receipt.'); END; /select to_char(sysdate,'dd-mm-yyyy hh24:mi:ss') from dual;EXEC DBMS_SCHEDULER.DROP_JOB('IDEAS.JOB_IDEAS_UPLOAD_RECEIPT');EXEC DBMS_SCHEDULER.RUN_JOB('WONDERSII.UPDATE_MEDICAL_FOR_CLIAMS');EXEC DBMS_SCHEDULER.ENABLE('JOB_SCHEDULE_SMSAMSMAST');EXEC DBMS_SCHEDULER.DISABLE('AMSLTS.REMOVEEXPIRED_ASPNET_SESSITEMS');EXEC DBMS_SCHEDULER.DISABLE('AMS.AMS_PKG_UNIT_STATEMENT');EXEC DBMS_SCHEDULER.ENABLE('AMS.AMS_PKG_UNIT_STATEMENT');EXEC DBMS_SCHEDULER.STOP_JOB('SYS.JOB_IDEAS_UPLOAD_RECEIPT');EXEC DBMS_SCHEDULER.STOP_JOB('IDEAS.JOB_IDEAS_UPLOAD_RECEIPT');EXEC DBMS_SCHEDULER.RUN_JOB('IDEAS.JOB_IDEAS_UPDATE_BUSINESSDATE');EXEC DBMS_SCHEDULER.DISABLE('JOB_IDEAS_UPLOAD_RECEIPT');EXEC DBMS_SCHEDULER.DISABLE('UNAUTHCHECKJOB');EXEC DBMS_SCHEDULER.ENABLE('IDEAS.JOB_IDEAS_UPDATE_BUSINESSDATE');EXEC DBMS_SCHEDULER.DROP_JOB('CP.SMS_OFFLINE_USER_TXN');EXEC DBMS_SCHEDULER.RUN_JOB('MFUNDMCY.EXP_MDEALING');Farzad - 9867156217SELECT name FROM dba_dependenciesWHERE referenced_name = 'DBMS_SCHEDULER'UNIONSELECT referenced_name FROM dba_dependenciesWHERE name = 'DBMS_SCHEDULER'; set lines 200set pages 200col owner for a12col JOB_ACTION for a50select owner,job_name,state,job_type,job_action,run_count,to_char(LAST_RUN_DURATION,'dd-mm-yyyy hh24:mi:ss'),to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),to_char(LAST_START_DATE,'dd-mm-yyyy hh24:mi:ss') from dba_scheduler_jobs where JOB_NAME like '%RECEIPT%';select owner,job_name,to_char(NEXT_RUN_DATE,'dd-mm-yyyy hh24:mi:ss'),JOB_ACTION from dba_scheduler_jobs where job_name like '%SP_WONDERS_DATA_CHECK%';To show details on job run:select log_date, job_name, status, req_start_date, actual_start_date, run_durationfrom dba_scheduler_job_run_detailsTo show running jobs:select job_name, session_id, running_instance, elapsed_time, cpu_usedfrom dba_scheduler_running_jobs;To show job history:select log_date, job_name, statusfrom dba_scheduler_job_log;show all schedules:select schedule_name, schedule_type, start_date, repeat_interval from dba_scheduler_schedules;show all jobs and their attributes:select *from dba_scheduler_jobsshow all program-objects and their attributesselect *from dba_scheduler_programs;show all program-arguments:select *from dba_scheduler_program_args;FREQ=DAILYfreq=daily;byhour=0;byminute=0;bysecond=0FREQ=MINUTELY;INTERVAL=60FREQ = HOURLY; INTERVAL = 1FREQ=DAILYFREQ=DAILYfreq=monthly;interval=1;bymonthday=1;byhour=01;byminute=01;bysecond=01FREQ=DAILY;BYHOUR=11;BYMINUTE=24;To run a job every Tuesday at 11:24, you could use any of the following (they are all equivalent):FREQ=DAILY; BYDAY=TUE; BYHOUR=11; BYMINUTE=24;FREQ=WEEKLY; BYDAY=TUE; BYHOUR=11; BYMINUTE=24;FREQ=YEARLY; BYDAY=TUE; BYHOUR=11; BYMINUTE=24;So far, this isn't much easier than the old-style Interval syntax. However, Calendaring syntax makes it much easier to specify more complex expressions. For example, to run a job every 3rd month on the 11th of the month, use the INTERVAL clause:FREQ=MONTHLY; INTERVAL=3; BYMONTHDAY=11;Varying intervals are much easier to express, too. To run a job Tuesday and Thursday at 11, 14 and 22 o'clock:FREQ=WEEKLY; BYDAY=TUE,THUR; BYHOUR=11,14,22;==============creation2:set long 999999select DBMS_METADATA.GET_DDL('USER',username) db_SCHEMAfrom dba_USERSwhere username like 'SWPROWHUB1';set long 999999select DBMS_METADATA.GET_DDL('TABLESPACE',tablespace_name) db_Tablespacefrom dba_tablespaceswhere tablespace_name like 'MFUND';set long 999999select DBMS_METADATA.GET_DDL('PROFILE',profile) db_SCHEMAfrom dba_Profileswhere PROFILE like '&MFUND';set long 999999select DBMS_METADATA.GET_DDL('PROFILE',profile) db_SCHEMAfrom dba_Profileswhere PROFILE like 'WONDERS';@getprofile:set long 999999select DBMS_METADATA.GET_DDL('PROFILE',profile) db_SCHEMAfrom dba_Profileswhere PROFILE like '&profile';set long 999999select DBMS_METADATA.GET_DDL('TYPE',object_name,'PRL_PROD') db_SCHEMAfrom dba_objectswhere object_type = 'TYPE' and owner like 'PRL%' and object_name = 'MYSCALARTYPE';set long 999999select DBMS_METADATA.GET_DDL('TABLE',table_name,'SWPROWHUB1') db_SCHEMAfrom dba_tableswhere table_name = 'AUDIT_TRAIL';set long 999999select DBMS_METADATA.GET_DDL('TABLE',table_name,'SAM_NEW') db_SCHEMAfrom dba_tableswhere table_name = 'ROOTWISE_AGENT_DETAILS';set long 999999select DBMS_METADATA.GET_DDL('TABLE',table_name,'AMS') db_SCHEMAfrom dba_external_tableswhere table_name = 'AMS_ELA_COMMISSION_DETAILS';set long 999999select DBMS_METADATA.GET_DDL('TABLE',table_name,owner) db_SCHEMAfrom dba_external_tableswhere table_name = upper('ams_lts_ext_lead_non_cc_upl');set long 999999select DBMS_METADATA.GET_DDL('SYNONYM',synonym_name,'PUBLIC') db_SCHEMAfrom dba_synonymswhere synonym_name like 'AMS_PKG_ALT_LEAD_DETAILS';set long 999999select DBMS_METADATA.GET_DDL('SYNONYM',synonym_name,'PUBLIC') db_SCHEMAfrom dba_synonymswhere synonym_name like 'TOAD_SPACE';drop PUBLIC SYNONYM TOAD_SPACE;CREATE OR REPLACE PUBLIC SYNONYM TOAD_SPACE FOR TOAD.TOAD_SPACE;set long 999999select DBMS_METADATA.GET_DDL('INDEX',index_name,'SWPROWHUB1') db_SCHEMAfrom dba_indexeswhere index_name like 'IDX_AUDIT_TRAIL_FK'; CREATE USER "WONDERSTEAM" IDENTIFIED BY VALUES '6A2F67D21BA72AD5'DEFAULT TABLESPACE "USERS"TEMPORARY TABLESPACE "TEMP"PROFILE "APP_USER_PROFILE" ; CREATE USER "WONDERSII_BKP" IDENTIFIED BY VALUES 'D6BA72C81E0C6EBE'DEFAULT TABLESPACE "TS_WONDERSII_DATA"TEMPORARY TABLESPACE "TEMP"PROFILE "WONDERS"ACCOUNT LOCK ; CREATE USER "WONDERSII" IDENTIFIED BY VALUES '8CAB501D9F604C89'DEFAULT TABLESPACE "TS_WONDERSII_DATA"TEMPORARY TABLESPACE "TEMP"PROFILE "WONDERS" ; CREATE USER "SAM_NEW" IDENTIFIED BY VALUES 'S:9CD142D3F27506DE4CB7F42413909B58C3FA7D039E28C364376447677440;9E332FF57FAC41C4'DEFAULT TABLESPACE "AMS_TRANSACTION_DATA"TEMPORARY TABLESPACE "TEMPGRP5";exec ams.Analyze_SB_Tables_rr; == VIVEK Execute this.======= SCHEMA @creation SQL Script ==============BIPLUS, HAAS, HPS, HSSundefine USRdefine USR=&USRSset head offset echo offset feedback offset long 999999set lines 160set pages 200spool ./SSRINI_Creation_Script2.sqlselect name,open_mode from gv$database;select DBMS_METADATA.GET_DDL('USER',username) db_SCHEMA from dba_USERS where username like '&&USR';select 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee like '&&USR';select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee = '&&USR';select 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS where grantee = '&&USR';spool off;set head onset echo onset feedback on============================================================================================================================ Schema Creation SHELL Script =====================================Both this Files to be created$ cat SC.shecho "set head off" > ./Users.sqlecho "set feedback off" >> ./Users.sqlecho "set lines 30" >> ./Users.sqlecho "set pages 999" >> ./Users.sqlecho "spool ./Users_rr.out" >> ./Users.sqlecho "select username from dba_users order by 1;" >> ./Users.sqlecho "spool off " >> ./Users.sqlecho "exit" >> ./Users.sqlsqlplus "/ as sysdba" @./Users.sqlecho "`cat ./Users_rr.out"v1=`cat Users_rr.out`for filename in $v1doecho "Schema Creation in Process for : $filename"echo "define USR=$filename" > ./Schema_Creation.sqlecho "`cat ./Schema_Creation.txt`" >> ./Schema_Creation.sqlsqlplus "/ as sysdba" @/u025/OWIP_rr/Schema_Creation.sqldone$$$$ cat Schema_Creation.txtset lines 160set pages 2002set time oncolumn machine format a20column event format a35column program format a30column schemaname for a10column action format a50set head offset echo offset feedback offset long 999999set lines 160set pages 200column FC_cdt new_value file_time noprintcolumn FC_DB new_value file_DB noprintcolumn FC_Usr new_value file_Usr noprintselect to_char(sysdate,'dd_mm_yyyy_hh24_mi_ss') FC_cdt from dual;select instance_name FC_DB from gv$instance;select username FC_Usr from dba_users where username = '&&USR';spool ./&file_DB._&file_Usr._Session_Check_&file_time..sqlselect name,open_mode from gv$database;select DBMS_METADATA.GET_DDL('USER',username) db_SCHEMA from dba_USERS where username like '&&USR';select 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee like '&&USR';select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee = '&&USR';select 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS where grantee = '&&USR';spool off;set head onset echo onset feedback onexit================================================================================================================spool c:\User_Priv.sqlselect 'grant '|| PRIVILEGE || ' to SWPRO;' from DBA_SYS_PRIVS where grantee like 'SWPRO';select 'grant '|| PRIVILEGE || ' to SWUSER;' from DBA_SYS_PRIVS where grantee like 'SYS';spool off;select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to amslts1;' from DBA_TAB_PRIVS where grantee = 'AMSLTS';select 'grant '|| GRANTED_ROLE || ' to amslts1;' from DBA_role_PRIVS where grantee = 'AMSLTS';select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee = 'PLANPROD';select * from DBA_tab_PRIVS where grantee = 'HP_DBSPI'; select * from DBA_role_PRIVS where granted_role = 'HP_DBSPI'; select * from DBA_sys_PRIVS where grantee = 'HP_DBSPI';SELECT 'grant CREATE VIEW,CREATE TABLE,ALTER SESSION,CREATE CLUSTER,CREATE SYNONYM,CREATE SEQUENCE,CREATE DATABASE LINK to '||grantee||';'FROM dba_role_privs WHERE granted_role = 'CONNECT' AND grantee NOT IN ('SYS', 'OUTLN', 'SYSTEM', 'CTXSYS', 'DBSNMP','LOGSTDBY_ADMINISTRATOR','ORDSYS','ORDPLUGINS', 'OEM_MONITOR', 'WKSYS', 'WKPROXY','WK_TEST','WKUSER', 'MDSYS', 'LBACSYS', 'DMSYS','WMSYS', 'OLAPDBA', 'OLAPSVR','OLAP_USER','OLAPSYS', 'EXFSYS', 'SYSMAN', 'MDDATA','SI_INFORMTN_SCHEMA','XDB', 'ODM');select distinct grantee from dba_sys_privs where privilege = 'CREATE VIEW'and privilege = 'CREATE TABLE'and privilege = 'ALTER SESSION'and privilege = 'CREATE CLUSTER'and privilege = 'CREATE SYNONYM'and privilege = 'CREATE SEQUENCE'and privilege = 'CREATE DATABASE LINK';and grantee ;select 'grant '|| GRANTED_ROLE || ' to SWUSER;' from DBA_role_PRIVS where grantee = 'SYS';select owner,sum(bytes/1024/1024/1024) from dba_segments where owner in (select username from dba_users where default_tablespace like 'USERS%') group by owner order by 2;define USR=&USRSset head offset echo offset feedback offset long 999999spool c:\SAM_NEW_USER_Creation_Script.sqlselect DBMS_METADATA.GET_DDL('USER',username) db_SCHEMAfrom dba_USERSwhere username like '&&USR';select 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee like '&&USR';select 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS where grantee = '&&USR';spool off;set head onset echo onset feedback onselect 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee like 'LEAP';select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where table_name = 'CP_DIR_CLIENT';spool d:\Priv_Wondersii.txtselect 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee like 'WONDERSII';select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee = 'WONDERSII';select 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS where grantee = 'WONDERSII';spool off;select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where table_name in (select directory_name from dba_directories);select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where table_name = 'AMS_ELA_COMMISSION_DETAILS';set head offset echo offset feedback offset lines 120set pages 999set long 999999spool c:\USER_Creation_Script.sqlselect 'Create tablespace ' || tablespace_name || ' datafile size 2G autoextend on;' from dba_tablespace;select DBMS_METADATA.GET_DDL('USER',username) db_SCHEMAfrom dba_USERS where default_tablespace not like 'SYS%';select 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee in (select username from dba_users where default_tablespace not like 'SYS%');select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee in (select username from dba_users where default_tablespace not like 'SYS%');select 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS where grantee in (select username from dba_users where default_tablespace not like 'SYS%');spool off;set head onset echo onset feedback onspool C:\Privs.txtselect 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS where grantee in (select username from dba_users where default_tablespace not like 'SYS%');select 'grant '|| PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee in (select username from dba_users where default_tablespace not like 'SYS%');select 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS where grantee in (select username from dba_users where default_tablespace not like 'SYS%');spool offselect 'grant '|| PRIVILEGE || ' on ' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee = 'SWPROWHUB1';=========================================set long 999999select DBMS_METADATA.GET_DDL('INDEX',index_name) db_SCHEMAfrom dba_indexeswhere table_name = 'AMS_LA_NGTV_CMSN_DETAILS';select 'grant '|| PRIVILEGE || ' on ' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS where grantee = 'AMS';======= PRIVILEGES ==============set long 999999select DBMS_METADATA.GET_DDL('USER',username) db_SCHEMAfrom dba_USERSwhere username like 'SAM_NEW';SET LONG 100000SELECT DBMS_METADATA.get_ddl('PROCOBJ','MY_TEST_JOB', 'TEST') AS job_def FROM dual;spool D:\Wipro-DBA\Privileges\DBA_SYS_PRIVS_All_Users.txtselect 'grant '|| PRIVILEGE || ' to SAM_NEW;' from DBA_SYS_PRIVS where grantee like 'AMS';select 'grant '|| PRIVILEGE || ' on ' || table_name || ' to SAM_NEW;' from DBA_TAB_PRIVS where grantee = 'ETL';select 'grant '|| GRANTED_ROLE || ' to SAM_NEW;' from DBA_role_PRIVS where grantee = 'ETL';spool D:\Wipro-DBA\Privileges\DBA_SYS_PRIVS_All_Users.txtselect 'grant '|| PRIVILEGE || ' to ' || grantee || ';' from DBA_SYS_PRIVS;spool off;spool D:\Wipro-DBA\Privileges\DBA_TAB_PRIVS_All_Users.txtselect 'grant ' || PRIVILEGE || ' on ' || owner || '.' || table_name || ' to ' || grantee || ';' from DBA_TAB_PRIVS;spool off;spool D:\Wipro-DBA\Privileges\DBA_ROLE_PRIVS_All_Users.txtselect 'grant '|| GRANTED_ROLE || ' to ' || grantee || ';' from DBA_role_PRIVS;spool off;==== PRIV Dynamic Queryselect 'grant SELECT,INSERT,UPDATE,DELETE ON ' || owner || '.' || table_name || ' to SIUDCDGR with grant option;' from dba_tables where num_rows is not null and TABLESPACE_NAME is not null and owner in (select username from dba_users where default_tablespace not in ('SYSTEM','SYS','SYSAUX','RMAN'))select 'grant SELECT,INSERT,UPDATE,DELETE ON ' || owner || '.' || table_name || ' to SIUDCDGR with grant option;' from dba_tables where num_rows is not null and TABLESPACE_NAME is not null and owner in (select username from dba_users where default_tablespace not in ('SYSTEM','SYS','SYSAUX','RMAN'))set pages 200set lines 200col owner for a10col db_link for a45col host for a20select * from dba_db_links;select grantee,table_owner,table_name,PRIVILEGE from DBA_TAB_PRIVS where grantee = 'AMSLTS';select grantee,table_owner,table_name,PRIVILEGE from DBA_TAB_PRIVS where grantee = 'LTSSEC';select grantee,PRIVILEGE,ADMIN_OPTION from DBA_SYS_PRIVS where grantee = 'SAM_NEW';select grantee,GRANTED_ROLE,ADMIN_OPTION from DBA_role_PRIVS where grantee = 'SAM_NEW';select grantee,PRIVILEGE,table_name from DBA_TAB_PRIVS where table_name like 'AMS_DIR_CFY%';select distinct PRIVILEGE from DBA_TAB_PRIVS;select distinct PRIVILEGE from DBA_SYS_PRIVS;select distinct GRANTED_ROLE from DBA_role_PRIVS;Granyted in 11g Systemgrant GLOBAL QUERY REWRITE to system;grant SELECT_CATALOG_ROLE to system;grant CREATE PUBLIC SYNONYM to sam_sit;select 'grant '|| PRIVILEGE || ' to sam_sit;' from DBA_SYS_PRIVS where grantee = 'SAM';select 'grant '|| PRIVILEGE || ' on ' || table_name || ' to ETL;' from DBA_TAB_PRIVS where grantee = 'ETL';select 'grant '|| GRANTED_ROLE || ' to sam_sit;' from DBA_role_PRIVS where grantee = 'SAM';DBMS_SWRF_INTERNAL---NOTE : -----To provide a user, select privilege on all the schemas -- Grant -- SELECT ANY TABLE -- This will provide select priv. on all the user except SYS Userse.g :-grant select any table to abc;-- This will provide select on all the table in database except of tables owned by SYS.create user sam_sit identified by sam_sit default tablespace ams_transaction_data quota unlimited on ams_transaction_data;@fullexpgrant DATAPUMP_EXP_FULL_DATABASE to user;grant DATAPUMP_IMP_FULL_DATABASE to user;grant IMP_FULL_DATABASE to sam_sit;grant CONNECT to sam_sit;grant RESOURCE to sam_sit;grant CREATE PUBLIC SYNONYM to sam_sit;grant CREATE ANY CONTEXT to sam_sit;grant UNLIMITED TABLESPACE to sam_sit;grant CREATE ANY DIRECTORY to sam_sit;grant DROP PUBLIC SYNONYM to sam_sit;grant ALTER SESSION to sam_sit;grant SELECT on V_$THREAD to SAM_SIT;grant SELECT on V_$PROCESS to SAM_SIT;grant SELECT on V_$SESSION to SAM_SIT;grant SELECT on V_$LATCH to SAM_SIT;grant SELECT on V_$MYSTAT to SAM_SIT;grant SELECT on V_$STATNAME to SAM_SIT;grant SELECT on V_$PARAMETER to SAM_SIT;grant SELECT on V_$INSTANCE to SAM_SIT;grant SELECT on V_$SESSION_WAIT to SAM_SIT;grant SELECT on V_$SYSTEM_EVENT to SAM_SIT;grant SELECT on GV_$THREAD to SAM_SIT;grant SELECT on GV_$PROCESS to SAM_SIT;grant SELECT on GV_$SESSION to SAM_SIT;grant SELECT on GV_$LATCH to SAM_SIT;grant SELECT on GV_$MYSTAT to SAM_SIT;grant SELECT on GV_$STATNAME to SAM_SIT;grant SELECT on GV_$PARAMETER to SAM_SIT;grant SELECT on GV_$INSTANCE to SAM_SIT;grant SELECT on GV_$SESSION_WAIT to SAM_SIT;grant SELECT on GV_$SYSTEM_EVENT to SAM_SIT;grant SELECT on V_$CONTEXT to SAM_SIT;grant SELECT on GV_$CONTEXT to SAM_SIT;grant EXECUTE on DBMS_SESSION to SAM_SIT;grant EXECUTE on DBMS_LOCK to SAM_SIT;grant READ on SAM_MASTERS to SAM_SIT;grant WRITE on SAM_MASTERS to SAM_SIT;======= LOCKS ========column owner format a10column object_name format a30column machine format a15column object_type format a10column osuser format a15column schemaname format a12select c.owner,c.object_name,c.object_type,b.sid,b.serial#,b.schemaname,b.status,b.osuser,b.machinefrom v$locked_object a,v$session b,sys.dba_objects cwhere b.sid = a.session_idand a.object_id = c.object_idorder by 2;and object_name = 'M_USERS'======= CPU UTIL Prasad ==========set pages 400set lines 300select ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, substr(ss.osuser,1,23) USER_NM,substr(ss.machine,1,23) MACHINE_NM,substr(ss.program,1,17) program,valuefrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%CPU used by this session%'and se.sid = ss.sidand ss.username is not nulland ss.status in ('ACTIVE')and ss.username not in ('SYS','SYSTEM')and value >=10000order by substr(name,1,25), value desc/======= Memory UTIL Prasad ==========set pages 400set lines 1000select ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, substr(ss.osuser,1,23) USER_NM,substr(ss.machine,1,23) MACHINE_NM,substr(ss.program,1,17) program, name,valuefrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and upper(name) like '%MEMORY%'and se.sid = ss.sidand ss.username is not nulland ss.status in ('ACTIVE')and ss.username not in ('SYS','SYSTEM')and value >=10000order by substr(name,1,25), value desc/select ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process,substr(ss.osuser,1,23) USER_NM,substr(ss.machine,1,23) MACHINE_NM,substr(ss.program,1,17) program,value,sn.namefrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and (name like '%session connect time%' or name like '%CPU used by this session%')and se.sid = ss.sidand ss.username is not nulland ss.status in ('ACTIVE')and ss.username not in ('SYS','SYSTEM')and value >= 10000order by value;Jyotsna Lotilikar - 9833495581select inst_id,sid,serial#,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi') from gv$session where sid in (select session_id from gv$locked_object where object_id=229790) order by logon_time;select inst_id,sid,serial#,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi'),schemaname from gv$session where program not like '%w3wp%' and program not like '%ORACLE%' order by logon_time;select sql_hash_value,event,action from v$session where sid=599;select SQL_TEXT from v$sqltext where HASH_VALUE='3114014027' order by PIECE;select SQL_TEXT from v$sqltext where HASH_VALUE='2440604873' order by PIECE;select * from gv$locked_object order by 5;select status,object_name,object_type,owner from dba_objects where object_name like '%CP_MAIL_PKG%';select schemaname,inst_id,sid,serial#,program,event , to_char(logon_time,'dd-mm-yyyy hh24:mi') from gv$session where program like 'sqlplus.exe';select status,object_name,object_type,owner from dba_objects where object_name like '%MV_PCRSTSH_PLAN_STORE_LIST%';Truncat table Issueams_pkg_salesbinder.ams_sp_cal_salesbinder;----CHECK Session working on--------select inst_id,sid,serial#,sql_hash_value,event from gv$session where username = 'ALT';----CHECK Session Hanged OR Working fine.-----select * from v$sess_io where sid in (select sid from v$session where username = 'ETL');------ramesh.lakshmana@wipro.com - 9741494008SQL> show parameter resouNAME TYPE VALUE------------------------------------ ----------- ------------------------------resource_limit boolean FALSEresource_manager_cpu_allocation integer 16resource_manager_plan string SCHEDULER[0x3008]:DEFAULT_MAINTENANCE_PLANSQL>select username,sid,serial#,program,event,action,to_char(logon_time,'DD-MM-YYYY hh24:mi:ss') from v$session where sid= &sid;select inst_id,username,sid,serial#,program,event,action,to_char(logon_time,'DD-MM-YYYY hh24:mi:ss'),sql_hash_value from gv$session where sid = 1;select * from DBA_DML_LOCKS order by 3;select * from DBA_DDL_LOCKS where session_id = 1 order by 2;-- Analyze TablesBEGINDBMS_STATS.gather_table_stats('RSPROD_ARCH','REQUEST',ESTIMATE_PERCENT => 0.1, METHOD_OPT => 'FOR COLUMNS CLOSEDDATE SIZE 254');END;/BEGIN dbms_stats.Gather_table_stats('SH', 'SALES', - method_opt => 'FOR ALL COLUMNS SIZE 1 FOR COLUMNS SIZE 254 CUST_ID'); END; /PL/SQL procedure successfully completed.SELECT column_name, num_distinct, histogram FROM user_tab_col_statistics WHERE table_name = 'SALES'; There are several other cases where you may need to provide a more complex setting for the METHOD_OPT parameter. Take for example a scenario where you don’t want any form of statistics on a column. There is no way to tell Oracle don’t gather statistics on a particular column, so you need to do the reverse and explicitly list the column you want to have statistics gathered on using the FOR COLUMNS syntax. Let’s assume we don’t want statistics of any kind on the PROD_ID column of the SALES TABLE. Then the DBMS_STATS.GATHER_TABLE_STATS command would be as follows;BEGIN dbms_stats.delete_column_stats('SH', 'SALES', 'PROD_ID'); END; /PL/SQL procedure completed successfully. BEGIN dbms_stats.Gather_table_stats('SH', 'SALES',-method_opt => 'FOR COLUMNS SIZE 254 CUST_ID TIME_ID CHANNEL_ID PROMO_ID QUANTITY_SOLD AMOUNT_SOLD'); END; /PL/SQL procedure completed successfully. -- The average row length still got recorded accurately even though we did not gather statistics on the PROD_ID column. SELECT num_rows, avg_row_len FROM user_tables WHERE table_name = 'SALES';SELECT column_name, num_distinct, histogram FROM user_tab_col_statistics WHERE table_name = 'SALES';Note the FOR COLUMNS syntax is only valid for the GATHER_TABLE_STATS procedure.Finally, at the start of this post I mentioned that the METHOD_OPT parameter can also be used to create extended statistics. Extended statistics encompasses two additional types of column statistics; column groups and expression statistics. In the example below, a column group will be automatically created on the PROD_ID and CUST_ID column in the SALES table. It will be given a system-generated name and will have all of the base column statistics gathered on it.BEGINdbms_stats.Gather_table_stats('SH', 'SALES',method_opt => 'FOR ALL COLUMNS SIZE 254 FOR COLUMNS SIZE 254(PROD_ID, CUST_ID)');END;/PL/SQL procedure successfully completed. SELECT column_name, num_distinct, histogram FROM user_tab_col_statistics WHERE table_name = 'SALES';Rather than specifying the METHOD_OPT parameter in the statistics gathering command it is highly recommended that you specify any non-default value for the METHOD_OPT via DBMS_STATS.SET_TABLE_PREFS.BEGINdbms_stats.Set_table_prefs('SH', 'SALES', 'METHOD_OPT', -'FOR ALL COLUMNS SIZE 254 FOR COLUMNS SIZE 1 PROD_ID');END;/ scsprod10.1.6.53scsEXEC DBMS_STATS.gather_schema_stats (ownname => 'SCS', cascade =>true,estimate_percent => 40);EXEC DBMS_STATS.gather_schema_stats (ownname => 'PDMLINK80', cascade =>true,estimate_percent => 40);create index ams.AMS_LA_COMMISSION_DETAILS_COL_2 on (agent_id,as_on_date);@analyzedynamic:---------------SELECT 'EXEC DBMS_STATS.gather_table_stats(''' || owner || ''',''' || table_name || ''',cascade => true);' from dba_tables where to_char(LAST_ANALYZED,'DD-MON-YY') not like '%JUN-12' and owner='IDEAS';select owner,table_name,last_analyzed from dba_tables where table_name = 'AMS_CONVERTED_RECEIPT_PREMIUM';--EXEC DBMS_STATS.gather_table_stats('POS_PROD', 'POS_TRN_PLS_RES2');--EXEC DBMS_STATS.gather_table_stats('POS_PROD', 'POS_TRN_CLS_RES2');EXEC DBMS_STATS.gather_table_stats('LEAP', 'DW_WT_POS_FE_1');EXEC DBMS_STATS.gather_table_stats('FCCPROD', 'STTB_UPLOAD_EXCEPTION');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_LA_COMMISSION_DETAILS');EXEC DBMS_STATS.gather_table_stats('IDEAS', 'IDEAS_QC_FIELD_ERROR');EXEC DBMS_STATS.gather_table_stats('PRL_PROD', 'PRL_CASE_AUDIT_TRAIL');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_PREMIUM_DEFECIT_HISTORY');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_PREMIUM_DEFECIT');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_CONVERTED_RECEIPT_PREMIUM');EXEC DBMS_STATS.gather_table_stats('PRL_PROD', 'RESOURCE_MASTER_MIRROR');EXEC DBMS_STATS.gather_table_stats('IDEAS', 'DW_WT_IDEAS_6');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_CONVERTED_RECEIPT_PREMIUM',estimate_percent => 15,cascade => true);EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_AGENT_HIERARCHY_TEMP',estimate_percent => 15,cascade => true);EXEC DBMS_STATS.gather_table_stats('CP', 'CP_CLIENT_MASTER',cascade => true);EXEC DBMS_STATS.gather_table_stats('CP', 'CP_USAGE_MASTER');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_RN_HRPRECS');EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMPLOYEES');EXEC DBMS_STATS.gather_table_stats('AMS', 'ROOTWISE_AGENT_DETAILS',estimate_percent => 15,cascade => true);EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_CLIENT_MASTER', estimate_percent => 15,cascade => true);EXEC DBMS_STATS.gather_table_stats('IWAN_STG', 'ADDRESS_ROW_FORM', estimate_percent => dbms_stats.auto_sample_size,cascade => true);EXEC DBMS_STATS.gather_table_stats('IWAN_STG', 'REPDB_CI', estimate_percent => dbms_stats.auto_sample_size,cascade => true);--EXEC DBMS_STATS.gather_schema_stats (ownname => 'MFUNDMCY', cascade =>true,estimate_percent => dbms_stats.auto_sample_size);EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_CONVERTED_RECEIPT_PREMIUM',cascade => true);EXEC DBMS_STATS.gather_table_stats('MFUNDMCY', 'WEB_T_PORTFOLIO',cascade => true);EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_PD_TOTALSCORECARD_RPT',cascade => true);EXEC DBMS_STATS.gather_table_stats('AMS', 'REPDB_CI',cascade => true);EXEC DBMS_STATS.gather_table_stats('AMS', 'ADDRESS_ROW_FORM',cascade => true);EXEC DBMS_STATS.gather_table_stats('AMH', 'AMS_SALES_AGGREGATION_MAIN',cascade => true);EXEC DBMS_STATS.gather_table_stats('PRL_WF_PROD', 'INSTANCE_STATE',cascade => true);EXEC DBMS_STATS.gather_table_stats('ETL', 'ETL_GTT_WAIT_STATS');EXEC DBMS_STATS.gather_table_stats('ETL', 'ETL_RUN_STATS');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_AGENT_HIERARCHY');EXEC DBMS_STATS.gather_table_stats('HSLRNRPROD', 'COL_MST_OTHERADDRESS');EXEC DBMS_STATS.gather_table_stats('HSLRNRPROD', 'COL_MST_PHONENUMBERS');EXEC DBMS_STATS.gather_table_stats('AMS', 'AMS_PRPSL_DETAILS',cascade => true);EXEC DBMS_STATS.gather_table_stats('BHADRESHD', 'TFORECASTN',cascade => true);EXEC DBMS_STATS.unlock_table_stats('FLEXPROD_HOST', 'XF_ST_CAP_INPUT_TXN');EXEC DBMS_STATS.gather_table_stats('FLEXPROD_HOST', 'XF_ST_CAP_INPUT_TXN', estimate_percent => 15,cascade => true);ams_policy_details_excludeEXEC DBMS_STATS.gather_table_stats('MFUNDMCY', 'WEB_T_PORTFOLIO',cascade => true);EXEC DBMS_STATS.gather_schema_stats (ownname => 'MFUNDMCY', cascade =>true,estimate_percent => dbms_stats.auto_sample_size);select table_name from dba_tables where table_name like '%STAT%' and table_name not like 'WRH%'and table_name not like 'WRI%'and owner='SYS';Object Levelexec dbms_stats.create_stat_table('SYS','&stattablename');exec dbms_stats.export_database_stats('&stattable','&statid','SYS');exec dbms_stats.export_schema_stats('&owner','&stattablename','&statid','SYS');======================= EVENT Check===========================select event, total_waits,round(time_waited/100) "TIME(s)",average_wait*10 "AVG(ms)",TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') timefrom v$system_eventwhere time_waited > 100 and (event like '%KSV%' or event like '%async%')order by time_waited============== Log Switch Time =================================@dailyarchset lines 120; set pages 999; select substr(time,1,5) day, to_char(sum(decode(substr(time,10,2),'00',1,0)),'99') "00", to_char(sum(decode(substr(time,10,2),'01',1,0)),'99') "01", to_char(sum(decode(substr(time,10,2),'02',1,0)),'99') "02", to_char(sum(decode(substr(time,10,2),'03',1,0)),'99') "03", to_char(sum(decode(substr(time,10,2),'04',1,0)),'99') "04", to_char(sum(decode(substr(time,10,2),'05',1,0)),'99') "05", to_char(sum(decode(substr(time,10,2),'06',1,0)),'99') "06", to_char(sum(decode(substr(time,10,2),'07',1,0)),'99') "07", to_char(sum(decode(substr(time,10,2),'08',1,0)),'99') "08", to_char(sum(decode(substr(time,10,2),'09',1,0)),'99') "09", to_char(sum(decode(substr(time,10,2),'10',1,0)),'99') "10", to_char(sum(decode(substr(time,10,2),'11',1,0)),'99') "11", to_char(sum(decode(substr(time,10,2),'12',1,0)),'99') "12", to_char(sum(decode(substr(time,10,2),'13',1,0)),'99') "13", to_char(sum(decode(substr(time,10,2),'14',1,0)),'99') "14", to_char(sum(decode(substr(time,10,2),'15',1,0)),'99') "15", to_char(sum(decode(substr(time,10,2),'16',1,0)),'99') "16", to_char(sum(decode(substr(time,10,2),'17',1,0)),'99') "17", to_char(sum(decode(substr(time,10,2),'18',1,0)),'99') "18", to_char(sum(decode(substr(time,10,2),'19',1,0)),'99') "19", to_char(sum(decode(substr(time,10,2),'20',1,0)),'99') "20", to_char(sum(decode(substr(time,10,2),'21',1,0)),'99') "21", to_char(sum(decode(substr(time,10,2),'22',1,0)),'99') "22", to_char(sum(decode(substr(time,10,2),'23',1,0)),'99') "23" from v$log_history group by substr(time,1,5);This log switch script is handy because it displays the log switch activity as a two-dimensional table, showing log switches by hours of the day and log switches by date:--------------------------------------------select nvl(ss.USERNAME,'ORACLE Back PROC') username,name,se.SID,VALUE cpu_usagefrom v$session ss, v$sesstat se, v$statname snwhere se.STATISTIC# = sn.STATISTIC#and (NAME like '%CPU used by this session%'or NAME like 'session pga memory')and se.SID = ss.SID and value <> 0and ss.sid = &SIDorder by sid desc;SELECTe.SID,e.username,e.status,a.UGA_MEMORY,b.PGA_MEMORYFROM(select y.SID, TO_CHAR(ROUND(y.value/1024),99999999) || ' KB' UGA_MEMORY from v$sesstat y, v$statname z where y.STATISTIC# = z.STATISTIC# and NAME = 'session uga memory') a,(select y.SID, TO_CHAR(ROUND(y.value/1024),99999999) || ' KB' PGA_MEMORY from v$sesstat y, v$statname z where y.STATISTIC# = z.STATISTIC# and NAME = 'session pga memory') b,v$session eWHERE e.sid=a.sidAND e.sid=b.sid--and a.sid in (453,560,297,321)and a.sid in (386,364)ORDER BYe.status,a.UGA_MEMORY desc;====== QUERY Taken Time =============column username format a10select sesion.sid,sesion.serial#,sesion.username,optimizer_mode,hash_value,address,round(cpu_time/1000000/60,0) CPU_MIN,round(elapsed_time/1000000/60,0) QURY_RUN_MIN,sql_textfrom v$sqlarea sqlarea, v$session sesionwhere sesion.sql_hash_value = sqlarea.hash_valueand sesion.sql_address = sqlarea.addressand sesion.username is not null and sesion.sid = &SID;-- Logon Time , STatusselect s.username "Oracle User",s.osuser "OS User",i.consistent_gets "Consistent Gets",i.physical_reads "Physical Reads",s.status "Status",s.sid "SID",s.serial# "Serial#",s.machine "Machine",s.program "Program",to_char(logon_time, 'DD/MM/YYYY HH24:MI:SS') "Logon Time",w.seconds_in_wait "Idle Time", P.SPID "PROC",name "Stat CPU", valuefrom v$session s, v$sess_io i, v$session_wait w, V$PROCESS P, v$statname n, v$sesstat twhere s.sid = i.sidand s.sid = w.sid (+)and 'SQL*Net message from client' = w.event(+)and s.osuser is not nulland s.username is not nulland s.paddr=p.addrand n.statistic# = t.statistic#and n.name like '%cpu%'and t.SID = s.sidorder by 6 asc, 3 desc, 4 desc;===================================================================================================================================================================================================================================================================================================================================================================================================================================================-- Database HIT Ratioselect 100 * (1-(pr.value/(bg.value + cg.value))) || '%' as "Hit Ratio", pr.value "Phys R", bg.value "Bl. Gets", cg.value "Cons Gets"from v$sysstat pr, v$sysstat bg, v$sysstat cg where pr.name='physical reads' and bg.name='db block gets' and cg.name ='consistent gets';-- LOCKScolumn osuser format a10column owner format a10column object_name format a15column machine format a15select c.owner,c.object_name,c.object_type,b.sid,b.serial#,b.status,b.osuser,b.machinefrom v$locked_object a,v$session b,dba_objects cwhere b.sid = a.session_idand a.object_id = c.object_idorder by 2;Here Log File means oracle Online Redo Log Files (this files records all the changes (transactions) done (like Inserts / Updates / Deletes) through any sessions inside the Oracle database). We observed that Oracle sessions where not able to read / Write in the Online redo log file, due to which the sessions got hanged / wait state, on this (Log File Sync) WAIT EVENT .-- CPU Utilization select * from (SELECT se.username, ss.sid, value CPU_UsageFROM v$session se, v$sesstat ss, v$statname stWHERE ss.statistic# = st.statistic# AND name LIKE '%roll%' AND se.sid = ss.SID and value > 10000 AND se.username IS NOT NULLORDER BY value DESC) a; -- INACTIVE Sessions Query Taking Time;select * from(SELECT se.username, ss.sid, value CPU_UsageFROM v$session se, v$sesstat ss, v$statname stWHERE ss.statistic# = st.statistic#AND name LIKE '%CPU used by this session%'AND se.sid = ss.SID and value <> 0AND se.username IS NOT NULL and se.sid in (select sid from v$session where status = 'INACTIVE')ORDER BY value DESC) a where rownum <= 15;--QUERY Taking time & Inf. by SIDcolumn username format a10select sesion.sid,sesion.serial#,sesion.username,optimizer_mode,hash_value,address,round(cpu_time/1000000/60,0) CPU_MIN,round(elapsed_time/1000000/60,0) QURY_RUN_MIN,sql_textfrom v$sqlarea sqlarea, v$session sesionwhere sesion.sql_hash_value = sqlarea.hash_valueand sesion.sql_address = sqlarea.addressand sesion.username is not null and sesion.sid = &SID;select SQL_TEXT from v$sqltext where HASH_VALUE='&HASH_VALUE' order by PIECE;-- ACTIVE - INACTIVE --selects.username,s.sid,s.serial#,p.pid ppid,s.status,s.osuser,substr(s.program,1,20) client_program,s.process client_process,substr(p.program,1,20) server_program,p.spid server_pidfrom v$session s, v$process pwhere s.username is not nulland p.addr(+) = s.paddr and s.sid = &sidorder by username, sid;/--ALL QUERY Taking TIME ---------column username format a10select sesion.sid,sesion.serial#,sesion.username,optimizer_mode,hash_value,address,round(cpu_time/1000000/60,0) CPU_MIN,round(elapsed_time/1000000/60,0) QURY_RUN_MIN,sql_textfrom v$sqlarea sqlarea, v$session sesionwhere sesion.sql_hash_value = sqlarea.hash_valueand sesion.sql_address = sqlarea.addressand sesion.username is not null order by elapsed_time desc;================@killinactive:select 'alter system kill session ''' ||sid|| ',' || serial#|| ''' immediate;' from v$session where status='INACTIVE' and username='<>';--- User Creation18:42:46 SQL> create user USR28 identified by usr28 default tablespace AMS_BIG_MASTER_DATA;User created.18:43:54 SQL> grant create session to USR28;Grant succeeded.18:44:19 SQL> grant create any table, select any table, create any trigger to usr28;set pages 200set lines 200column machine format a20column event format a35column program format a20column action format a20select sid,serial#,machine,program,event,action,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),schemanamefrom v$session;create table logon_tbl (who varchar2(30), when date);create or replace trigger trg_logon_dbafter insert on usr28.sess for each rowbegininsert into usr28.logon_tbl (who, when) values (user, sysdate);end trg_logon_db;/Manoj - 9221081723create or replace trigger trg_logon_dbafter logon on databasebegininsert into usr28.logon_tbl (who, when) values (user, sysdate);end trg_logon_db;/select TRIGGER_NAME,TABLE_OWNER,TABLE_NAME,STATUS,action_type from user_triggers where trigger_name = 'TRG_LOGON_DB';create table sess(sid number,serial number,USERNAME varchar2(20),schemaname varchar2(20),STATUS varchar2(8),machine varchar2(64),terminal varchar2(16),program varchar2(64),action varchar2(32),SQL_HASH_VALUE number,logon_time date);==== Final Trigger ===========drop trigger usr28.USR28_LOGON_S10;drop trigger usr28.trg_logon_db;drop trigger sys.USR28_LOGON_S10;drop trigger sys.trg_logon_db;create or replace trigger USR28_LOGON_S10before insert on usr28.logon_tbl for each rowbegininsert into usr28.sess (sid,serial,username,schemaname,status,machine,terminal,program,action,sql_hash_value,logon_time) (select sid,serial#,username,schemaname,status,machine,terminal,program,action,sql_hash_value,logon_time from v$sessionwhere logon_time = (select max(logon_time) from v$session) and (schemaname = 'USR28' or username = 'USR28'));end;/create or replace trigger trg_logon_dbafter logon on databasebegininsert into usr28.logon_tbl (who, when) values (user, sysdate);end trg_logon_db;/====================================================================-- With SIDcolumn username format a10select sesion.sid,sesion.serial#,sesion.username,optimizer_mode,hash_value,address,round(cpu_time/1000000/60,0) CPU_MIN,round(elapsed_time/1000000/60,0) QURY_RUN_MIN,sql_textfrom v$sqlarea sqlarea, v$session sesionwhere sesion.sql_hash_value = sqlarea.hash_valueand sesion.sql_address = sqlarea.addressand sesion.username is not null and sesion.sid = &SIDorder by elapsed_time desc;-- Logon TIME, Status, by SIDcolumn "Oracle User" format a10column Program format a20column "Stat CPU" format a20column "OS User" format a10select s.username "Oracle User",s.osuser "OS User",i.consistent_gets "Consistent Gets",i.physical_reads "Physical Reads",s.status "Status",s.sid "SID",s.serial# "Serial#",s.machine "Machine",s.program "Program",to_char(logon_time, 'DD/MM/YYYY HH24:MI:SS') "Logon Time",w.seconds_in_wait "Idle Time", P.SPID "PROC",name "Stat CPU", valuefrom v$session s, v$sess_io i, v$session_wait w, V$PROCESS P, v$statname n, v$sesstat twhere s.sid = i.sidand s.sid = w.sid (+)and 'SQL*Net message from client' = w.event(+)and s.osuser is not nulland s.username is not nulland s.paddr=p.addrand n.statistic# = t.statistic#and n.name like '%cpu%'and t.SID = s.sidand s.sid = &SIDorder by 6 asc, 3 desc, 4 desc;-- CPU in Seconds.select * from (select ss.username,se.SID,VALUE/100 cpu_usage_secondsfromv$session ss, v$sesstat se, v$statname snwherese.STATISTIC# = sn.STATISTIC#andNAME like '%CPU used by this session%'andse.SID = ss.SIDand ss.status='INACTIVE' and ss.username <> 'CP'and ss.username is not nullorder by VALUE desc) where rownum <= 15;select sid,serial#,program,status from v$session where status = 'INACTIVE';-- Checking Tablespace SizeSET LINES 150SET pages 300col "Tablespace" FOR a30col "Total MB" FOR a15col "Used MB" FOR a15col "% Used" FOR a15SELECT tablespace_name "Tablespace",d.STATUS "Status",TO_CHAR((a.bytes / 1048576),'99,999,990.900') "Total MB",TO_CHAR(((a.bytes - DECODE(f.bytes, NULL, 0, f.bytes)) / 1048576),'99,999,990.900') "Used MB",TO_CHAR((((a.bytes - DECODE(f.bytes, NULL, 0, f.bytes)) / 1048576)*100) / (a.bytes / 1048576),'999,999.9') "% Used"FROM (sys.dba_tablespaces d JOIN sys.sm$ts_avail a USING (tablespace_name)) LEFT OUTER JOIN sys.sm$ts_free f USING (tablespace_name)ORDER BY 5;Prompt ================Uptime==================select to_char(STARTUP_TIME,'dd/mm/yyyy hh24:mm') from v$instance;prompt ======================TEMP TABLESPACE=================================================SELECT tablespace_name, SUM(bytes_used/1024/1024), SUM(bytes_free/1024/1024)FROM V$temp_space_headerGROUP BY tablespace_name;===================================================================================================================================================================================================================================================================================================================================================================================================================================================Good Links===========http://www.oraclefaq.net/2007/06/21/how-to-delete-a-node-from-3-node-rac-in-10gr2/http://www.idevelopment.info/data/Oracle/DBA_tips/Oracle10gRAC/CLUSTER_22.shtml#Remove%20the%20Node%20from%20the%20ClusterRMAN======SQL> create tablespace rman datafile size 1G autoextend on;Tablespace created.SQL> CREATE USER rman IDENTIFIED BY rman2 TEMPORARY TABLESPACE temp13 DEFAULT TABLESPACE rman4 QUOTA UNLIMITED ON rman;User created.SQL> GRANT connect, resource, recovery_catalog_owner TO rman;Grant succeeded.SQL> select count(*) from dba_objects where owner = 'RMAN'; COUNT(*)----------252SQL>C:\>set oracle_sid=hlportal1C:\>rman catalog=rman/rmanRecovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 11 21:13:15 2011Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.connected to recovery catalog databaseRMAN> create catalog tablespace "rman";error creating dbORACLE error from recovery catalog database: ORA-00959: tablespace 'rman' does not existORACLE error from recovery catalog database: ORA-00942: table or view does not existRMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-06433: error installing recovery catalogRMAN> create catalog tablespace rman;RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-00558: error encountered while parsing input commandsRMAN-01009: syntax error: found "rman": expecting one of: "double-quoted-string, identifier, single-quoted-string"RMAN-01007: at line 1 column 27 file: standard inputRMAN> create catalog;recovery catalog createdRMAN> exitRecovery Manager complete.C:\>rman catalog=rman/rman target /Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 11 21:15:59 2011Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.connected to target database: HLPORTAL (DBID=214138538)connected to recovery catalog databaseRMAN> reister database;RMAN-00571: ===========================================================RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============RMAN-00571: ===========================================================RMAN-00558: error encountered while parsing input commandsRMAN-01009: syntax error: found "identifier": expecting one of: "advise, allocate, alter, backup, @, catalog, changRMAN-01008: the bad identifier was: reisterRMAN-01007: at line 1 column 1 file: standard inputRMAN> exitRecovery Manager complete.C:\>rman catalog=rman/rman target=/Recovery Manager: Release 11.2.0.1.0 - Production on Mon Apr 11 21:16:52 2011Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.connected to target database: HLPORTAL (DBID=214138538)connected to recovery catalog databaseRMAN> create catalog;recovery catalog createdRMAN> register database;database registered in recovery catalogstarting full resync of recovery catalogfull resync completeRMAN>change backuppiece '' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16982_1_20100425_IMLC1N5E_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16983_1_20100425_INLC1N5E_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16984_1_20100425_IOLC1N5E_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16985_1_20100425_IPLC1PEF_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16986_1_20100425_IQLC1PGQ_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16987_1_20100425_IRLC1PJG_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16988_1_20100425_ISLC1RQB_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16989_1_20100425_ITLC1RS3_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16990_1_20100425_IULC1RUP_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16991_1_20100425_IVLC1U4L_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16992_1_20100425_J0LC1U7V_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16993_1_20100425_J1LC1U9D_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16994_1_20100425_J2LC20G3_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16995_1_20100425_J3LC20G4_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16996_1_20100425_J4LC20I6_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16997_1_20100426_J5LC235S_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16998_1_20100426_J6LC235T_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_16999_1_20100426_J7LC2397_1_1.BAK' uncatalog;change backuppiece 'E:\Backup\Backup_Compress\Rman\DAILY_FULL_17000_1_20100426_J8LC25P4_1_1.BAK' uncatalog;catalog start with ''; catalog start with 'E:\Backup\'; restore database;crosscheck backup;list backupset;CROSSCHECK backup of database;crosscheck backupset;delete expired backupset;catalog start with 'E:\Backup\';restore database;crosscheck archivelog all;restore controlfile from 'E:\Backup\C-2213995706-20100426-00';RMAN> run {2> set newname for datafile '+DATA/hdfcprod/datafile/system.322.656800181' to 'E:\hdfcprod\datafile\system.322.656800181';3> recover datafile 1;4> switch datafile 1;5> }RUN {RECOVER COPY OF DATABASE WITH TAG 'incr_update' UNTIL TIME 'SYSDATE-7';BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'incr_upd'DATABASE;}RMAN> BACKUP SPFILE TO DESTINATION '/u01/backups';RMAN> BACKUP TAG 'weekly_full_db_bkup' DATABASE ;BACKUP tag 'Mdealing_Full_25102011' INCREMENTAL LEVEL 0 DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;RUN {RECOVER COPY OF DATABASE WITH TAG 'Mdealing_Full_25102011';BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG 'Mdealing_Full_incr_25102011'DATABASE;}BACKUP tag 'Mdealing_Full_25102011' INCREMENTAL LEVEL 0 DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;BACKUP tag 'Mdealing_INCR1_25102011' INCREMENTAL LEVEL 1 DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;FINAL Differential INCREMENTAL BACKUP;backup as copy current controlfile format 'E:\Requets_Backup\Control_25102011.ctl';----------- BACKUP ------------------BACKUP tag 'Mdealing_FULL_25102011' INCREMENTAL LEVEL 0 DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;BACKUP tag 'Mdealing_INCR1_25102011' INCREMENTAL LEVEL 1 DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;BACKUP tag 'Mdealing_INCR1_25102011' INCREMENTAL LEVEL 1 DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;----------- RESOTRE -----------------RMAN> restore database;RMAN> recover copy of database with tag 'Mdealing_INCR2_25102011';==== Tablespace Level RMAN-- Backup --RMAN> BACKUP INCREMENTAL LEVEL 1 TABLESPACE tools FORMAT 'c:\RMANBKUP\tools_L1';-- Restore --RMAN> run { allocate channel t1 type 'sbt_tape' parms2> 'ENV=(TDPO_OPTFILE=/opt/tivoli/tsm/client/oracle/bin64/tdpo.opt)';3> sql "alter tablespace TEST_TS offline immediate";4> restore tablespace TEST_TS;5> recover tablespace TEST_TS;6> sql "alter tablespace TEST_TS online";7> release channel t1;8> }Normal RMAN Backup ====BACKUP tag 'HLOPS2_BKP' DATABASE filesperset 10 format 'E:\Request_backup\daily_FULL_DB_%s_%p_%T_%U.bak' include current controlfile;===================================================================set newname for datafile '+DATA/hdfcprod/datafile/system.322.656800181' to 'D:\oracle\product\10.2.0\Oradata\hdfcprod\datafile\system.322.656800181';connect target sys/sys@ORCL;ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK; report obSOlete;CROSSCHECK BACKUP;CROSSCHECK COPY;DELETE EXPIRED BACKUP;DELETE EXPIRED COPY;delete obsolete;release channel;CHANGE BACKUPPIECE '/oradata2/oft7qq' UNCATALOG;RESTORING Through RMAN ARCHIVE BACKUPPIECE===========================================RMAN run{RMAN set archivelog destination to 'F:\PRLPROD\ARCHIVE';RMAN }RMAN list backup of archivelog all; ## check SequenceRMAN restore archivelog from sequence 11111 until sequence 222222;SQL> recover database using backup controlfile;Provide ARCH FileName;Then Provide REDO Log File;IT will show MEDIA RECOVERY COMPLETESQL> alter database open resetlogs;SQL> shut immediate;SQL> alter database open;restore archivelog from logseq=100 until logseq=110;restore archivelog from time='15-JUN-05' until time='20-JUN-05';recover database;restore archivelog from time='15-JUN-05' until time='20-JUN-05';=== BACKUP Database / Controlfile / Archive log Files in BACKUPPIECES======================================================================CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'F:\RMAN_Backup\HDFCAML_Controlfile\%F';CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'TO YOUR PATH/%F';CONFIGURE CONTROLFILE AUTOBACKUP ON;=== RCV File Riyazrun{allocate channel ch1 type disk maxpiecesize 4G;allocate channel ch2 type disk maxpiecesize 4G;allocate channel ch3 type disk maxpiecesize 4G;allocate channel ch4 type disk maxpiecesize 4G;BACKUP AS COMPRESSED BACKUPSET DATABASE format 'TO YOU PATH\daily_FULL_DB_%s_%p_%T_%U.bak' filesperset 10; BACKUP ARCHIVELOG from time 'sysdate-1' format 'TO YOU PATH\daily_ARCH_%s_%p_%T_%U.bak' filesperset 10 ;release channel ch1;release channel ch2;release channel ch3;release channel ch4;}connect target /HDFCBANKCONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/fc_precut_dump/RMAN_06062013/FULL_DB_%s_%p_%T_%U.bak';CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/fc_precut_dump/RMAN_06062013/FULL_DB_%s_%p_%T_%U.bak';run{backup as compressed backupset database plus archivelog skip inaccessible including current controlfile;backup current controlfile;backup current controlfile for standby;}CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/odgdump/SCN_19072013/%F';CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/odgdump/SCN_19072013/SCN_DB_%s_%p_%T_%U.bak';BACKUP INCREMENTAL FROM SCN 47987632 DATABASE;==PerfectCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/odgdump/SCN_19072013/%F';CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/odgdump/SCN_19072013/SCN_DB_%s_%p_%T_%U.bak';BACKUP INCREMENTAL FROM SCN 47987632 DATABASE;run{backup as compressed backupset database plus archivelog skip inaccessible;backup current controlfile;}SCN RMAN RESTORE=====================1....On Standby Database.select name,open_mode,CURRENT_SCN from v$database;2....On Primary Database.a. BACKUP DEVICE TYPE SBT INCREMENTAL FROM SCN 750923 DATABASE;b. BACKUP INCREMENTAL FROM SCN 750923 DATABASE;c. BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASEFORMAT '/tmp/incr_standby_%U';3....On Primary Database.Backup Controlfile3....On Standby Database.RESTORE at STANDBY SideRMAN> CATALOG START WITH '/standbydisk1/incrback/';4....On Standby Database.START RECOVERRMAN> RECOVER DATABASE NOREDO;========backup as copy current controlfile format 'F:\RMAN_Backup\HDFCAML_Controlfile\HDFCAML_CTL.cfl';backup as copy current controlfile format 'E:\Requets_Backup\Control_25102011.ctl';============================================================================================================Incremental Differential BackupBACKUP INCREMENTAL LEVEL 0 DATABASE format 'D:\wipro-dba\RMAN_Incremental\daily_FULL_DB_%s_%p_%T_%U.bak' filesperset 10;BACKUP INCREMENTAL LEVEL 1 DATABASE format 'D:\SAM_NEW\daily_FULL_DB_1_%s_%p_%T_%U.bak' filesperset 10;Incremental CUMULATIVE BackupBACKUP INCREMENTAL LEVEL 0 CUMULATIVE DATABASE format 'D:\wipro-dba\RMAN_Incremental\daily_FULL_DB_%s_%p_%T_%U.bak' filesperset 10;BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE format 'D:\SAM_NEW\daily_FULL_DB_1_%s_%p_%T_%U.bak' filesperset 10;To store the change tracking file in the database area, set DB_CREATE_FILE_DEST in the target database. Then issue the following SQL statement to enable change tracking:ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;============================================================================================================================== Parag MailHi,As discussed with Swapnil, he is Telling both ETL & CC Applications are running Slow.As Analyzed, found that there is constant LOCK on below Tables with Session & also it is utilizing , Find details below:SID SERIAL# PROCEDURE Running SCHEMA USER====== ========= ======================== ========= ==========214 479 begin AMS.AMS_PKG_BL.AMS_INCENTI ETL ETL556 4512 begin cp_sch_pkg.sp_ia_payment; SYS ETLLock Acquired in Table:========================214 Session on Node 1:ETL_RUN_STATSETL_WAIT_STATSETL_GTT_WAIT_STATS556 Session on Node 2:CP_IA_PAYMENT_ALERT_DTLRevert if anything needs to be done from my side.==================================================================== Rename UNNAMED File to Proper File name.alter database create datafile 'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00012' as '+DATA_IDEAS/pinnacle/datafile/ideas.318.719999863';select 'set newname for datafile ,' || name || ', to ,DOG'|| name || ';' from v$datafile;select 'set newname for datafile ''' || name || ''' to ''DOG'|| name || ''';' from v$datafile;select 'alter database rename file ''' || name || ''' to ''DOG'|| name || ''';' from v$tempfile;select 'alter database rename file ''' || member || ''' to ''DOG'|| member || ''';' from v$logfile;select tablespace_name||',set newname for datafile ,' || file_name || ', to ,DOG'|| file_name || ',;,' ||bytes/1024/1024/1024 from dba_data_files order by 1;column file_name format a65column tablepsace_name format a22set pages 200set lines 200select tablespace_name||','||file_name||','||bytes/1024/1024/1024 from dba_data_files order by 1;select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files;col FN for a15select substr(file_name,1,4) FN, sum(bytes/1024/1024/1024) from dba_data_files group by substr(file_name,1,4);== If alter database create datafile 'OLD File' as 'NEW File'; Doesnot workRMAN> run {2> set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00012' to '+DATA_IDEAS/pinnacle/datafile/ideas.318.719999863';3> restore datafile 12;4> recover datafile 12;5> }select thread#,sequence#,to_char(first_time,'DD-MON-YYYY HH24:MI:SS') from v$log_history where sequence# in (select max(sequence#) from v$log_history group by thread#);=========================================================================Oracle 11galter system set optimizer_features_enable='10.2.0.4' scope=memoryalter session set optimizer_features_enable='10.2.0.4'VAR R REFCURSOR;EXEC ALT_PKG_LGWISE_REPORTS.ALT_SP_GET_MTD_SUMMARY_REP('HD01',0,:r);print r;Oracle 11g AWR Report StartingAssign Parameters:SQL> show parameter CONTROL_MANAGEMENT_PACNAME_COL_PLUS_SHOW_PARAM TYPE VALUE_COL_PLUS_SHOW_PARAM---------------------------------------- ----------- ------------------------------control_management_pack_access string DIAGNOSTIC+TUNINGSQL>SQL> show parameter statistics_levelNAME_COL_PLUS_SHOW_PARAM TYPE VALUE_COL_PLUS_SHOW_PARAM---------------------------------------- ----------- ------------------------------statistics_level string TYPICALSQL>select distinct STAT_NAME,VALUE from V$sess_TIME_MODEL order by 1;select snap_interval, retention from dba_hist_wr_control;select distinct STAT_NAME,VALUE from V$Sys_TIME_MODEL order by 1;col stat_name for a35select * from V$OSSTAT ;select * from v$license;SELECT a.job_name, a.enabled, c.window_name, c.schedule_name, c.start_date, c.repeat_intervalFROM dba_scheduler_jobs a, dba_scheduler_wingroup_members b, dba_scheduler_windows cWHERE job_name='GATHER_STATS_JOB'And a.schedule_name=b.window_group_nameAnd b.window_name=c.window_name;Execute Procedureslike:BEGINDBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();END;/BEGINDBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS( retention => 1440,interval => 60);END;/@$ORACLE_HOME/rdbms/admin/awrextr.sql@?/rdbms/admin/awrload.sql@$ORACLE_HOME/rdbms/admin/awrrpt.sqlBEGINDBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE (low_snap_id => 102, high_snap_id => 122, dbid => 8187786345);END;/awrrpt.sqlThe awrrpt.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids.awrrpti.sqlThe awrrpti.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids on a specified database and instance.awrsqrpt.sqlThe awrsqrpt.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a range of snapshot Ids. Run this report to inspect or debug the performance of a SQL statement.awrsqrpi.sqlThe awrsqrpi.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a range of snapshot Ids on a specified database and instance. Run this report to inspect or debug the performance of a SQL statement on a specific database and instance.awrddrpt.sqlThe awrddrpt.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration settings between two selected time periods.awrddrpi.sqlThe awrddrpi.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration settings between two selected time periods on a specific database and instance.Workload Repository ViewsThe following workload repository views are available:V$ACTIVE_SESSION_HISTORY - Displays the active session history (ASH) sampled every second. V$METRIC - Displays metric information. V$METRICNAME - Displays the metrics associated with each metric group. V$METRIC_HISTORY - Displays historical metrics. V$METRICGROUP - Displays all metrics groups. DBA_HIST_ACTIVE_SESS_HISTORY - Displays the history contents of the active session history. DBA_HIST_BASELINE - Displays baseline information. DBA_HIST_DATABASE_INSTANCE - Displays database environment information. DBA_HIST_SNAPSHOT - Displays snapshot information. DBA_HIST_SQL_PLAN - Displays SQL execution plans. DBA_HIST_WR_CONTROL - Displays AWR settings. =========================================================================Oracle 11g Mail SendingSELECT host, acl,DECODE(DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE_ACLID(aclid, 'ETL', 'resolve'),1, 'GRANTED', 0, 'DENIED', NULL) privilegeFROM dba_network_acls;Example1Grant the connect and resolve privileges for host www.us.oracle.com to SCOTT.BEGINDBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'www.xml',description => 'WWW ACL',principal => 'SCOTT',is_grant => true,privilege => 'connect'); DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'www.xml',principal => 'SCOTT',is_grant => true,privilege => 'resolve'); DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'www.xml',host => 'www.us.oracle.com');END;/COMMIT;Example 2Grant the resolve privilege for www.us.oracle.com to ADAMS. Since an ACL for www.us.oracle.com exists already, just add the privilege for ADAMS.BEGINDBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'www.xml',principal => 'ADAMS',is_grant => true,privilege => 'resolve');END;/COMMIT;Example 3Assign the ACL www.xml to www-proxy.us.oracle.com so that SCOTT and ADAMS can access www-proxy.us.oracle.com also.BEGINDBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'www.xml',host => 'www-proxy.us.oracle.com');END;/COMMIT;Example 4Unassign the ACL from www.us.oracle.com so that no access to www.us.oracle.com is allowed.BEGINDBMS_NETWORK_ACL_ADMIN.UNASSIGN_ACL(host => 'www.us.oracle.com');END;/COMMIT;BEGINDBMS_NETWORK_ACL_ADMIN.DELETE_PRIVILEGE(acl => 'us-oracle-com-permissions.xml',principal => 'ST_USERS')END;BEGINDBMS_NETWORK_ACL_ADMIN.DROP_ACL(acl => 'us-oracle-com-permissions.xml');END;==============================================Advantage of ASM :Flexible --> Without shutting down database , can add new Disk / Space in ASM.Fault Tolerance --> ASM handles the mirroring of data, Once datas Inserted in the datafiles it never / hardly gets lost.Productivity increases --> Space management is taken care of by ASM.In Oracle 10g Multiple ASM instance is possible so that if 1 ASM Instance needs to be stopped, others are not affected.If I drop a tablespace, ASM will figure out which datafile(s) are no longer required and will then automatically remove the physical files without any intervention on my part.=======ed lockselect sid, user#, username, command, lockwait, status from gv$sessionWHERE LOCKWAIT is not null======@edplanset pages 0set lines 10000set long 10000select plan_table_output from table(dbms_xplan.display_cursor('&sqlid'));======ed plan2select plan_table_output from table(dbms_xplan.display_awr('&sqlid'));======@cpuutiliztionset pages 400set lines 300col user_process for a14col user_nm for a11col machine_nm for a5col program for a22col event for a30select ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, --SS.SQL_ID,substr(ss.program,1,17) program,event,value, ss.sql_hash_value,ss.sql_id,substr(ss.osuser,1,23) USER_NM,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),substr(ss.machine,1,23) MACHINE_NMfrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%CPU used by this session%'and se.sid = ss.sid-- and ss.username is not null-- and ss.status in ('ACTIVE')-- and ss.username not in ('SYS','SYSTEM')and value >=10000order by substr(name,1,25), value desc;col COLUMN_NAME for a30select table_name,column_name,index_name from dba_ind_columns where table_name='MST_MSG_STOR_TBL' order by 3;alter system kill session '378,12759' immediate;519,6797514,30636513,20883set pages 400set lines 300col user_process for a20col user_nm for a20col machine_nm for a20col program for a30col event for a40col sidd for a55select substr (ss.username||'('||se.sid||')',1,15) user_process, to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'), ss.program,'alter system kill session ''' || ss.sid || ',' || ss.serial# || ''' immediate;' SIDDfrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%CPU used by this session%'and se.sid = ss.sidand ss.username is not null-- and ss.status in ('ACTIVE')and ss.username not in ('SYS','SYSTEM')and value >=10000and ss.logon_time not like sysdateorder by ss.logon_time;order by substr(name,1,25), value asc;======set serverout on size 999999declarebegindbms_output.put_line(’ ‘);dbms_output.put_line(’************* Start report for WAITING sessions with current SQL ***************’);for x in (select vs.inst_id, vs.sid || ‘,’ || vs.serial# sidser, vs.sql_address, vs.sql_hash_value,vs.last_call_et, vsw.seconds_in_wait, vsw.event, vsw.statefrom gv$session_wait vsw, gv$session vswhere vsw.sid = vs.sidand vsw.inst_id = vs.inst_idand vs.type <> ‘BACKGROUND’and vsw.event NOT IN (’rdbms ipc message’,’smon timer’,’pmon timer’,’SQL*Net message from client’,’lock manager wait for remote message’,’ges remote message’,’gcs remote message’,’gcs for action’,’client message’,’pipe get’,’Null event’,’PX Idle Wait’,’single-task message’,’PX Deq: Execution Msg’,’KXFQ: kxfqdeq - normal deqeue’,’listen endpoint status’,’slave wait’,’wakeup time manager’))loopbegindbms_output.put_line(’Event WaitState InstID SidSerial LastCallEt SecondsInWait’);dbms_output.put_line(’************************* ******************** ****** *********** ********** *************’);dbms_output.put_line(rpad(x.event,25) ||’ ‘|| rpad(x.state,20) ||’ ‘|| lpad(x.inst_id,6) ||’ ‘|| lpad(x.sidser,11) ||’‘|| lpad(x.last_call_et,10) ||’ ‘|| lpad(x.seconds_in_wait,13));dbms_output.put_line(’ SQLText ‘);dbms_output.put_line(’****************************************************************’);for y in (select sql_textfrom gv$sqltextwhere address = x.sql_addressand hash_value = x.sql_hash_valueand inst_id = x.inst_idorder by piece)loopdbms_output.put_line(y.sql_text);end loop;end;end loop;dbms_output.put_line(’************** End report for sessions waiting with current SQL ****************’);dbms_output.put_line(’ ‘);end;/======ed UTLMEMORYset pages 400set lines 300col user_process for a12col program for a30col event for a30col USER_NM for a14col LOGON_TIME for a20select ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, substr(ss.program,1,17) program,event,value,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LOGON_TIME,substr(ss.osuser,1,23) USER_NM,substr(ss.machine,1,23) MACHINE_NM,ss.terminalfrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%session pga memory%'and se.sid = ss.sid-- and ss.username is not null-- and ss.status in ('ACTIVE')-- and ss.username not in ('SYS','SYSTEM')and value >= 10339and ss.logon_time not like sysdateorder by value;set pages 400set lines 300col user_process for a15col program for a21col event for a30col USER_NM for a14col LOGON_TIME for a20col machine_nm for a14select ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, substr(ss.program,1,17) program,event,value,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LOGON_TIME,substr(ss.osuser,1,23) USER_NM,substr(ss.machine,1,23) MACHINE_NMfrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%session pga memory%'and se.sid = ss.sid-- and ss.username is not null-- and ss.status in ('ACTIVE')and ss.username not in ('SYS','SYSTEM')and value >= 10339and ss.logon_time not like sysdateorder by value;==================ed POOLUsages, SHARED_POOL, LARGE_POOL SELECT pool,name,bytes/1024/1024 FROM V$SGASTAT where name like 'free memory';==================ed UTLPROCESSset pages 400set lines 300col user_process for a20col program for a30col event for a40col USER_NM for a10col schemaname for a15col LOGON_TIME for a20select distinct ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, substr(ss.program,1,17) program,event,value,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LOGON_TIME,substr(ss.osuser,1,23) USER_NM, schemaname-- substr(ss.machine,1,23) MACHINE_NMfrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%process%'and se.sid = ss.sid-- and ss.username is not null-- and ss.status in ('INACTIVE')and ss.username not in ('SYS','SYSTEM')-- and value >= 10339and ss.logon_time not like sysdateorder by value;=======================ed UTLpoolset pages 400set lines 300col user_process for a20col program for a30col event for a40col USER_NM for a10col schemaname for a15col LOGON_TIME for a20select distinct ss.inst_id,ss.sid,ss.serial#,substr (ss.username||'('||se.sid||')',1,15) user_process, substr(ss.program,1,17) program,event,value,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LOGON_TIME,substr(ss.osuser,1,23) USER_NM, schemaname-- substr(ss.machine,1,23) MACHINE_NMfrom gv$session ss, gv$sesstat se, gv$statname snwhere se.statistic# = sn.statistic#and name like '%pool%'and se.sid = ss.sid-- and ss.username is not null-- and ss.status in ('INACTIVE')and ss.username not in ('SYS','SYSTEM')-- and value >= 10339and ss.logon_time not like sysdateorder by value;======select program,to_char(logon_time,'dd-mon-yyyy'),count(*) from gv$session where schemaname not like 'SYS%' group by program,to_char(logon_time,'dd-mon-yyyy') order by to_char(logon_time,'dd-mon-yyyy');col logon_time for a25select program,to_char(logon_time,'dd-mon-yyyy'),count(*) from gv$session where schemaname not like 'SYS%' group by program,to_char(logon_time,'dd-mon-yyyy') order by to_char(logon_time,'dd-mon-yyyy');=================ed usingtempset lines 400set pages 9999col sid_serial for a12col program for a30col event for a40col username for a15col tablespace for a15col status for a10SELECT a.inst_id,a.sid||','||a.serial# SID_SERIAL, to_char(a.logon_time,'dd-mm-yyyy hh24:mi:ss'),a.program,a.event,(sum(b.extents)* 1024*1024)/1024/1024 MB_space,b.tablespace tablespace,a.sql_hash_value,a.username, a.osuser, c.spid Process,a.status --,'alter system kill session ''' || a.sid || ',' || a.serial# || ''' immediate;' "sids"FROM gv$session a,gv$sort_usage b, gv$process c, dba_tablespaces dWHERE a.saddr = b.session_addrAND a.paddr = c.addrAND b.tablespace=d.tablespace_name -- and schemaname not like '%SYS%'and b.extents*1024*1024 > 1000group by a.username, a.osuser, a.sid||','||a.serial#,c.spid,b.tablespace, a.status,a.program,a.event, a.inst_id,a.logon_time,a.sid,a.serial#,a.sql_hash_value order by MB_space asc,a.logon_time asc;set lines 400set pages 9999col sid_serial for a12col program for a30col event for a40col username for a15col tablespace for a15col status for a10SELECT a.inst_id,a.sid||','||a.serial# SID_SERIAL, to_char(a.logon_time,'dd-mm-yyyy hh24:mi:ss'),a.program,a.event,(sum(b.extents)* 1024*1024)/1024/1024 MB_space,b.tablespace tablespace,a.sql_hash_value,a.username, a.osuser, c.spid Process,a.statusFROM gv$session a,gv$sort_usage b, gv$process c, dba_tablespaces dWHERE a.saddr = b.session_addrAND a.paddr = c.addrAND b.tablespace=d.tablespace_name and schemaname not like '%SYS%'-- and b.extents*1024*1024 > 10000group by a.username, a.osuser, a.sid||','||a.serial#,c.spid,b.tablespace, a.status,a.program,a.event, a.inst_id,a.logon_time,a.sid,a.serial#,a.sql_hash_value order by MB_space asc,a.logon_time asc;For 8iset lines 400set pages 9999col sid_serial for a12col program for a30col event for a40col username for a15col tablespace for a15col status for a10SELECT a.inst_id,a.sid||','||a.serial# SID_SERIAL, to_char(a.logon_time,'dd-mm-yyyy hh24:mi:ss'),a.program,(sum(b.extents)* 1024*1024)/1024/1024 MB_space,b.tablespace tablespace,a.sql_hash_value,a.username, a.osuser, c.spid Process,a.status, 'alter system kill session ''' || a.sid || ',' || a.serial# || ''' immediate;' "sids"FROM gv$session a,gv$sort_usage b, gv$process c, dba_tablespaces dWHERE a.saddr = b.session_addrAND a.paddr = c.addrAND b.tablespace=d.tablespace_name and schemaname not like '%SYS%'and b.extents*1024*1024 > 1000group by a.username, a.osuser, a.sid||','||a.serial#,c.spid,b.tablespace, a.status,a.program,a.inst_id,a.logon_time,a.sid,a.serial#,a.sql_hash_value order by MB_space asc,a.logon_time asc;set lines 400set pages 9999col sid_serial for a12col program for a30col event for a40col username for a15col tablespace for a15col status for a10SELECT a.inst_id,a.sid||','||a.serial# SID_SERIAL, to_char(a.logon_time,'dd-mm-yyyy hh24:mi:ss'),a.program,(sum(b.extents)* 1024*1024)/1024/1024 MB_space,b.tablespace tablespace,a.sql_hash_value,a.username, a.osuser,a.status, 'alter system kill session ''' || a.sid || ',' || a.serial# || ''' immediate;' "sids"FROM gv$session a,gv$sort_usage bWHERE a.saddr = b.session_addrand schemaname not like '%SYS%'and b.extents*1024*1024 > 1000group by a.username, a.osuser, a.sid||','||a.serial#,b.tablespace, a.status,a.program,a.inst_id,a.logon_time,a.sid,a.serial#,a.sql_hash_value order by MB_space asc,a.logon_time asc;=======ed usingundocol osuser for a15col user for a10col undo_tbs for a12col SEGMENT_NM for a15col command for a30set pages 9999set lines 200SELECT ds.TABLESPACE_NAME "UNDO_TBS",ds.RELATIVE_FNO "File Nos",r.name "SEGMENT_NM", s.sid, s.serial#,s.osuser, s.username "USER", t.status,t.cr_get, t.phy_io, t.used_ublk, t.noundo,substr(s.program, 1, 78) "COMMAND", c.sql_textFROM sys.v_$session s, sys.v_$transaction t, sys.v_$rollname r,dba_segments ds,v$sql cWHERE t.addr = s.taddrand t.xidusn = r.usnand s.sql_hash_value = c.hash_valueand ds.segment_name = r.name(+)--and s.program not like 'ORACLE.EXE%'ORDER BY t.cr_get, t.phy_io;========ed sofarset time onset lines 300set pages 9999col program for a30col event for a35col inst_id for 99col context for 99999col Wait_Secs for a10col LT for a20SELECT l.inst_id,l.sid, l.serial#, l.context, l.sofar, l.totalwork, l.sofar/l.totalwork*100 "% Complete",s.program,s.event, s.seconds_in_wait || ' ' Wait_Secs,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT-- ,s.blocking_session, s.client_info--, s.p1, s.p2, s.p3,, s.client_info, s.module,l.opnameFROM gv$session_longops l, gv$session sWHERE l.sid=s.sidAND l.serial# = s.serial#--AND upper(l.opname) LIKE 'RMAN%'--AND l.sid in (select session_id from gv$locked_object)--AND l.opname NOT LIKE '%aggregate%'--AND s.logon_time not like sysdate--AND s.sid = 1566--AND s.program like 'ORACLE.EXE (J0%'--AND s.program like 'oracle@usclvwuca002 (D%'--AND s.program like '%JDBC%'--AND upper(l.opname) like '%EXP%'--and logon_time not like sysdateAND l.totalwork != 0 --AND l.totalwork <> l.sofarORDER BY logon_time desc;09819741718===set time onset lines 300set pages 9999col program for a50col event for a35col inst_id for 99col context for 99999col Wait_Secs for a10col LT for a20col CST for a20SELECT l.inst_id,l.sid, l.serial#, l.context, l.sofar, l.totalwork, l.sofar/l.totalwork*100 "% Complete",s.program,s.event, s.seconds_in_wait || ' ' Wait_Secs,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss') LT,to_char(logon_time-1/24,'dd-mm-yyyy hh24:mi:ss') CST--, s.p1, s.p2, s.p3,, s.client_info, s.moduleFROM gv$session_longops l, gv$session sWHERE l.sid=s.sidAND l.serial# = s.serial#--AND l.opname LIKE 'RMAN%'--AND l.sid in (select session_id from gv$locked_object)--AND l.opname NOT LIKE '%aggregate%'--AND s.logon_time not like sysdate--AND s.sid = 1045--AND s.program like 'ORACLE.EXE (J0%'AND l.totalwork != 0 ORDER BY 7 desc,logon_time;select sid,serial#,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),osuser from gv$session where osuser='oracle' and program like 'rman%' order by logon_time;select schemaname,username,sid,serial#,program,event,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss'),osuser from gv$session where sid=&sid order by logon_time;Check rman TAPE backupCOLUMN EVENT FORMAT a40COLUMN SECONDS_IN_WAIT FORMAT 999COLUMN STATE FORMAT a20COLUMN CLIENT_INFO FORMAT a20COLUMN state FORMAT a10SELECT p.SPID, s.sid, s.serial#,s.program,s.event, sw.SECONDS_IN_WAIT AS SEC_WAIT, sw.STATE, s.CLIENT_INFOFROM V$SESSION_WAIT sw, V$SESSION s, V$PROCESS pWHERE sw.EVENT LIKE '%sbt%'AND s.SID=sw.SIDAND s.PADDR=p.ADDR;select decode(backup_type||controlfile_included||incremental_level,'LNO','ARC', 'DYES', 'CTL', 'DNO', 'DBF_FULL', 'DNO0','DBF_LVL_0','INO1','DBF_LVL_1'),round(sum(original_input_bytes)/1024/1024,2) "MB in",round(sum(output_bytes)/1024/1024,2) "MB out",status,min(start_time),max(completion_time),round((sum(output_bytes)/1024/1024)/((max(completion_time)-min(start_time))*86400), 1) "MB/s"from v$backup_set_detailsgroup by backup_type, controlfile_included, incremental_level, status, session_key, session_recid, session_stamporder by 5;--ORDER BY inst_id,sid,serial#;SELECT l.sid, l.serial#, l.sofar, l.totalwork, l.sofar/l.totalwork*100 "% Complete",s.program,s.event,s.p1, s.p2, s.p3FROM gv$session_longops l, gv$session sWHERE l.sid=s.sidAND l.serial# = s.serial#--AND l.opname LIKE 'RMAN%'--AND l.sid in (select session_id from gv$locked_object)--AND l.opname NOT LIKE '%aggregate%'--AND s.logon_time not like sysdate--AND s.sid = 1632--AND s.program like 'ORACLE.EXE (J0%'AND l.totalwork != 0 ORDER BY 7 desc,logon_time;SELECT l.sid, l.serial#, l.sofar, l.totalwork, l.sofar/l.totalwork*100 "% Complete",s.program,s.event,s.p1, s.p2, s.p3FROM gv$session_longops l, gv$session sWHERE l.sid=s.sidAND l.serial# = s.serial#--AND l.opname LIKE 'RMAN%'--AND l.sid in (select session_id from gv$locked_object)--AND l.opname NOT LIKE '%aggregate%'--AND s.logon_time not like sysdateAND s.sid = 1166--AND s.program like 'ORACLE.EXE (J0%'AND l.totalwork != 0 ORDER BY 7 desc,logon_time;================select * from dba_jobs_running;select * from dba_scheduler_running_jobs;set lines 300set pages 9999col program for a30col event for a35col inst_id for 99col context for 99999col Wait_Secs for a10SELECT l.inst_id,l.sid, l.serial#, l.context, l.sofar, l.totalwork,s.program,s.event, s.seconds_in_wait || ' ' Wait_Secs,to_char(logon_time,'dd-mm-yyyy hh24:mi:ss')--, s.p1, s.p2, s.p3,, s.client_info, s.moduleFROM gv$session_longops l, gv$session sWHERE l.sid=s.sidAND l.serial# = s.serial#--AND l.opname LIKE 'RMAN%'--AND l.sid in (select session_id from gv$locked_object)--AND l.opname NOT LIKE '%aggregate%'--AND s.logon_time not like sysdateAND s.sid = 1613--AND s.program like 'ORACLE.EXE (J0%'--AND l.totalwork != 0 ORDER BY logon_time;--ORDER BY inst_id,sid,serial#;=============ed checkarchivelogstatusset lines 200set pages 9999col r.sequence# for 999,999,999col handle for a80select r.sequence# sequence, p.handle handle, to_char(l.first_time,'DD-MON-YYYY HH24:MI:SS') from v$backup_piece p, v$backup_redolog r, v$log_history lwhere r.set_stamp = p.set_stamp and r.set_count = p.set_countand l.sequence# = r.sequence#and r.sequence# = (select max(r.sequence#) from v$backup_redolog r)order by 1;--and r.sequence# = 63set lines 200set pages 9999col r.sequence# for 999,999,999col handle for a80select r.sequence# sequence, p.handle handle, to_char(l.first_time,'DD-MON-YYYY HH24:MI:SS') from v$backup_piece p, v$backup_redolog r, v$log_history lwhere r.set_stamp = p.set_stamp and r.set_count = p.set_countand l.sequence# = r.sequence#and l.sequence# = 140581order by 1;===============ed open_Cursor_Checkcol hwm_open_cur format 99,999col max_open_cur format 99,999select max(a.value) as hwm_open_cur, p.value as max_open_curfrom v$sesstat a, v$statname b, v$parameter pwhere a.statistic# = b.statistic# and b.name = 'opened cursors current'and p.name= 'open_cursors'group by p.value;===============ed logswitchset linesize 112set pagesize 100column day format a15 heading ' Day'column d_0 format a3 heading ' 00'column d_1 format a3 heading ' 01'column d_2 format a3 heading ' 02'column d_3 format a3 heading ' 03'column d_4 format a3 heading ' 04'column d_5 format a3 heading ' 05'column d_6 format a3 heading ' 06'column d_7 format a3 heading ' 07'column d_8 format a3 heading ' 08'column d_9 format a3 heading ' 09'column d_10 format a3 heading ' 10'column d_11 format a3 heading ' 11'column d_12 format a3 heading ' 12'column d_13 format a3 heading ' 13'column d_14 format a3 heading ' 14'column d_15 format a3 heading ' 15'column d_16 format a3 heading ' 16'column d_17 format a3 heading ' 17'column d_18 format a3 heading ' 18'column d_19 format a3 heading ' 19'column d_20 format a3 heading ' 20'column d_21 format a3 heading ' 21'column d_22 format a3 heading ' 22'column d_23 format a3 heading ' 23'select substr(to_char(FIRST_TIME,'YYYY/MM/DD, DY'),1,15) day,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'00',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'00',1,0))) d_0,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'01',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'01',1,0))) d_1,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'02',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'02',1,0))) d_2,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'03',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'03',1,0))) d_3,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'04',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'04',1,0))) d_4,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'05',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'05',1,0))) d_5,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'06',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'06',1,0))) d_6,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'07',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'07',1,0))) d_7,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'08',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'08',1,0))) d_8,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'09',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'09',1,0))) d_9,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'10',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'10',1,0))) d_10,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'11',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'11',1,0))) d_11,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'12',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'12',1,0))) d_12,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'13',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'13',1,0))) d_13,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'14',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'14',1,0))) d_14,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'15',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'15',1,0))) d_15,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'16',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'16',1,0))) d_16,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'17',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'17',1,0))) d_17,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'18',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'18',1,0))) d_18,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'19',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'19',1,0))) d_19,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'20',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'20',1,0))) d_20,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'21',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'21',1,0))) d_21,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'22',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'22',1,0))) d_22,decode(sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'23',1,0)),0,'-',sum(decode(substr(to_char(FIRST_TIME,'HH24'),1,2),'23',1,0))) d_23from gv$log_historywhere FIRST_TIME >= sysdate - 15group bysubstr(to_char(FIRST_TIME,'YYYY/MM/DD, DY'),1,15)order bysubstr(to_char(FIRST_TIME,'YYYY/MM/DD, DY'),1,15) desc;set linesize 150set pagesize 9999clear columnsOI@4c3ss.13W3lc0m3.oi@13=========ed rmanbackupset lines 999set pages 200column START_TIME format a30;column END_TIME format a30;column INPUT_BYTES for 999999999999select * from (select to_char(START_TIME,'DD-MON-YYYY:HH24:MI:SS') START_TIME,to_char(END_TIME,'DD-MON-YYYY:HH24:MI:SS') END_TIME,ELAPSED_SECONDS/60 ELAPSED_MINS,INPUT_TYPE,OUTPUT_DEVICE_TYPE,STATUS,TRUNC(START_TIME) BKP_DATE, INPUT_BYTES/1024/1024 I_MB , OUTPUT_BYTES/1024/1024 O_MBfrom V$RMAN_BACKUP_JOB_DETAILS order by BKP_DATE desc) where rownum <25 --0 and INPUT_TYPE like '%INCR%'order by BKP_DATE desc; set lines 999column START_TIME format a30;column END_TIME format a30;column INPUT_BYTES for 999999999999select * from (select to_char(START_TIME,'DD-MON-YYYY:HH24:MI:SS') START_TIME,to_char(END_TIME,'DD-MON-YYYY:HH24:MI:SS') END_TIME,ELAPSED_SECONDS/60 ELAPSED_MINS,INPUT_TYPE,OUTPUT_DEVICE_TYPE,STATUS,TRUNC(START_TIME) BKP_DATE, INPUT_BYTES/1024/1024 I_MB , OUTPUT_BYTES/1024/1024 O_MBfrom V$RMAN_BACKUP_JOB_DETAILS where start_time like sysdate order by BKP_DATE desc) where rownum <25order by 1 desc; set lines 999column START_TIME format a30;column END_TIME format a30;column INPUT_BYTES for 999999999999select * from (select to_char(START_TIME,'DD-MON-YYYY:HH24:MI:SS') START_TIME,to_char(END_TIME,'DD-MON-YYYY:HH24:MI:SS') END_TIME,ELAPSED_SECONDS/60 ELAPSED_MINS,INPUT_TYPE,OUTPUT_DEVICE_TYPE,STATUS,TRUNC(START_TIME) BKP_DATE, INPUT_BYTES/1024/1024 I_MB , OUTPUT_BYTES/1024/1024 O_MBfrom V$RMAN_BACKUP_JOB_DETAILS order by BKP_DATE desc) where rownum <= 25order by BKP_DATE;Darpan - ITO DBA: SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo01.log'' TO ''?/oradata/test/redo01.log'' ";SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo02.log'' TO ''?/oradata/test/redo02.log'' ";Darpan - ITO DBA: https://www.rooms.hp.com/attend/default.aspx?key=RPQ9YJJMDF----- 1/16/14 12:17 AM ----- Darpan - ITO DBA: SQL> col media for a15ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YY HH24:MI';Session altered.select b.media, b.db_key,' ', b.tag, b.start_time,' ', b.completion_timefrom bp b, rc_database rwhere start_time > '11-JAN-14 23:30' and completion_time < '12-JAN-14 2:00'and b.db_key=r.db_key--and r.dbid=2724273581order by 1;=========ed rmantape ----- PERFECT rrset lines 200set pages 9999col PKEY for 9999999col BACKUP_TYPE for a20col STATUS for a10col FNAME for a45col TAG for a30Col MEDIA for a15col Complete for a20SELECT PKEY, BACKUP_TYPE, STATUS, FNAME FNAME,OBSOLETE, TAG, MEDIA,to_char(COMPLETION_TIME,'dd-mm-yyyy hh24:mi:ss') Complete FROM V$BACKUP_FILES WHERE COMPLETION_TIME between sysdate - 60 and sysdateAND BACKUP_TYPE <> 'COPY'--and FNAME like '%lvl%'order by completion_time;SELECT PKEY, BACKUP_TYPE, STATUS, FNAME FNAME,OBSOLETE, TAG, MEDIA,to_char(COMPLETION_TIME,'dd-mm-yyyy hh24:mi:ss') Complete FROM V$BACKUP_FILES WHERE COMPLETION_TIME between sysdate - 30 and sysdateAND BACKUP_TYPE <> 'COPY'--and FNAME like '%lvl%'order by completion_time;SELECT PKEY, BACKUP_TYPE, STATUS, FNAME FNAME,OBSOLETE, TAG, MEDIA,to_char(COMPLETION_TIME,'dd-mm-yyyy hh24:mi:ss') Complete FROM V$BACKUP_FILES WHERE COMPLETION_TIME like (sysdate - 4)order by completion_time;SELECT PKEY, BACKUP_TYPE, STATUS, FNAME FNAME, TAG, MEDIA,to_char(COMPLETION_TIME,'dd-mm-yyyy hh24:mi:ss') Complete FROM V$BACKUP_FILES WHERE TO_CHAR(COMPLETION_TIME,'YYYY-MM-DD') = '2014-01-12'and FNAME like '%arch%'order by completion_time;SELECT PKEY, BACKUP_TYPE, STATUS, FNAME FNAME, TAG, MEDIA FROM V$BACKUP_FILES WHERE TO_CHAR(COMPLETION_TIME,'YYYY-MM-DD') = '2014-01-12'and FNAME like '%arch%'order by media; 143260 BACKUP SET AVAILABLE P44_ustlsoi010_arch_<P44_al_ncat_t836692211_s190946_p1>.bak TAG20140112T223011 70553===695147=========ed lockholderset lines 1000SELECT /*+ rule */DECODE(request,0,'Holder: ','Waiter: ')||sid sess,type,INST_ID,id1,id2,lmode,request,ctime,blockFROMgv$lockWHERE(id1, id2, type) IN(SELECT id1, id2, type FROM gv$lock WHERE request >0) and lmode=6ORDER BY id1, request/=======ed rmanstatusset line 300SELECT SID, SERIAL#, CONTEXT,opname, SOFAR, TOTALWORK,ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"FROM V$SESSION_LONGOPSWHERE OPNAME LIKE 'RMAN%'AND OPNAME NOT LIKE '%rman%'AND TOTALWORK != 0AND SOFAR <> TOTALWORK;========ed orderset serveroutput on size 50000set echo off feed off veri offaccept SID prompt 'Enter Oracle SID: 'DECLAREv_sid number;s sys.v_$session%ROWTYPE;p sys.v_$process%ROWTYPE;BEGINbeginselect sid into v_sidfrom sys.v_$session swhere sid = &&SID;exceptionwhen no_data_found thendbms_output.put_line('Unable to find SID &&SID!!!');return;when others thendbms_output.put_line(sqlerrm||'naaaaaaaaaaaaaaaaaaaaa');return;end; select * into s from sys.v_$session where sid = v_sid;select * into p from sys.v_$process where addr = s.paddr; dbms_output.put_line('=====================================================================');dbms_output.put_line('SID/Serial : '|| s.sid||','||s.serial#);dbms_output.put_line('Foreground : '|| 'PID: '||s.process||' - '||s.program);dbms_output.put_line('Shadow : '|| 'PID: '||p.spid||' - '||p.program);dbms_output.put_line('Terminal : '|| s.terminal || '/ ' || p.terminal);dbms_output.put_line('OS User : '|| s.osuser||' on '||s.machine);dbms_output.put_line('Ora User : '|| s.username);dbms_output.put_line('Status Flags: '|| s.status||' '||s.server||' '||s.type);dbms_output.put_line('Tran Active : '|| nvl(s.taddr, 'NONE'));dbms_output.put_line('Login Time : '|| to_char(s.logon_time, 'Dy HH24:MI:SS'));dbms_output.put_line('Last Call : '|| to_char(sysdate-(s.last_call_et/60/60/24), 'Dy HH24:MI:SS') || ' - ' || to_char(s.last_call_et/60, '9999999999.0') || ' min');dbms_output.put_line('Lock/ Latch : '|| nvl(s.lockwait, 'NONE')||'/ '||nvl(p.latchwait, 'NONE'));dbms_output.put_line('Latch Spin : '|| nvl(p.latchspin, 'NONE')); dbms_output.put_line('Current SQL statement:');for c1 in ( select * from sys.v_$sqltextwhere HASH_VALUE = s.sql_hash_value order by piece) loopdbms_output.put_line(chr(9)||c1.sql_text);end loop; dbms_output.put_line('Previous SQL statement:');for c1 in ( select * from sys.v_$sqltextwhere HASH_VALUE = s.prev_hash_value order by piece) loopdbms_output.put_line(chr(9)||c1.sql_text);end loop; dbms_output.put_line('Session Waits:');for c1 in ( select * from sys.v_$session_wait where sid = s.sid) loopdbms_output.put_line(chr(9)||c1.state||': '||c1.event);end loop; dbms_output.put_line('Connect Info:');for c1 in ( select * from sys.v_$session_connect_info where sid = s.sid) loopdbms_output.put_line(chr(9)||': '||c1.network_service_banner);end loop; dbms_output.put_line('Locks:');for c1 in ( selectdecode(l.type,-- Long locks'TM', 'DML/DATA ENQ', 'TX', 'TRANSAC ENQ','UL', 'PLS USR LOCK',-- Short locks'BL', 'BUF HASH TBL', 'CF', 'CONTROL FILE','CI', 'CROSS INST F', 'DF', 'DATA FILE ','CU', 'CURSOR BIND ','DL', 'DIRECT LOAD ', 'DM', 'MOUNT/STRTUP','DR', 'RECO LOCK ', 'DX', 'DISTRIB TRAN','FS', 'FILE SET ', 'IN', 'INSTANCE NUM','FI', 'SGA OPN FILE','IR', 'INSTCE RECVR', 'IS', 'GET STATE ','IV', 'LIBCACHE INV', 'KK', 'LOG SW KICK ','LS', 'LOG SWITCH ','MM', 'MOUNT DEF ', 'MR', 'MEDIA RECVRY','PF', 'PWFILE ENQ ', 'PR', 'PROCESS STRT','RT', 'REDO THREAD ', 'SC', 'SCN ENQ ','RW', 'ROW WAIT ','SM', 'SMON LOCK ', 'SN', 'SEQNO INSTCE','SQ', 'SEQNO ENQ ', 'ST', 'SPACE TRANSC','SV', 'SEQNO VALUE ', 'TA', 'GENERIC ENQ ','TD', 'DLL ENQ ', 'TE', 'EXTEND SEG ','TS', 'TEMP SEGMENT', 'TT', 'TEMP TABLE ','UN', 'USER NAME ', 'WL', 'WRITE REDO ','TYPE='||l.type) type,decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',4, 'S', 5, 'RSX', 6, 'X',to_char(l.lmode) ) lmode,decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',4, 'S', 5, 'RSX', 6, 'X',to_char(l.request) ) lrequest,decode(l.type, 'MR', o.object_name,'TD', o.object_name,'TM', o.object_name,'RW', 'FILE#='||substr(l.id1,1,3)||' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,'WL', 'REDO LOG FILE#='||l.id1,'RT', 'THREAD='||l.id1,'TS', decode(l.id2, 0, 'ENQUEUE', 'NEW BLOCK ALLOCATION'),'ID1='||l.id1||' ID2='||l.id2) objnamefrom sys.v_$lock l, dba_objects owhere sid = s.sidand l.id1 = o.object_id(+) ) loopdbms_output.put_line(chr(9)||c1.type||' H: '||c1.lmode||' R: '||c1.lrequest||' - '||c1.objname);end loop; dbms_output.put_line('=====================================================================');END;/undef SID================= MPHASIS 19/09/2013 ======Create HP_DBSPI User for DBMON DB Monitoringset verify off;whenever sqlerror CONTINUEcreate user hp_dbspi. identified by "hp_dbspi"default tablespace temptemporary tablespace temp;grant create session to hp_dbspi;grant select on DBA_2PC_NEIGHBORS to hp_dbspi;grant select on DBA_2PC_PENDING to hp_dbspi;grant select on DBA_ANALYZE_OBJECTS to hp_dbspi;grant select on DBA_AUDIT_EXISTS to hp_dbspi;grant select on DBA_AUDIT_OBJECT to hp_dbspi;grant select on DBA_AUDIT_SESSION to hp_dbspi;grant select on DBA_AUDIT_STATEMENT to hp_dbspi;grant select on DBA_AUDIT_TRAIL to hp_dbspi;grant select on DBA_CATALOG to hp_dbspi;grant select on DBA_CLU_COLUMNS to hp_dbspi;grant select on DBA_CLUSTER_HASH_EXPRESSIONS to hp_dbspi;grant select on DBA_CLUSTERS to hp_dbspi;grant select on DBA_COL_COMMENTS to hp_dbspi;grant select on DBA_COL_PRIVS to hp_dbspi;grant select on DBA_COLL_TYPES to hp_dbspi;grant select on DBA_CONS_COLUMNS to hp_dbspi;grant select on DBA_CONSTRAINTS to hp_dbspi;grant select on DBA_DATA_FILES to hp_dbspi;grant select on DBA_DB_LINKS to hp_dbspi;grant select on DBA_DEPENDENCIES to hp_dbspi;grant select on DBA_DIRECTORIES to hp_dbspi;grant select on DBA_ERRORS to hp_dbspi;grant select on DBA_EXP_FILES to hp_dbspi;grant select on DBA_EXP_OBJECTS to hp_dbspi;grant select on DBA_EXP_VERSION to hp_dbspi;grant select on DBA_EXTENTS to hp_dbspi;grant select on DBA_FREE_SPACE to hp_dbspi;grant select on DBA_FREE_SPACE_COALESCED to hp_dbspi;grant select on DBA_FREE_SPACE_COALESCED_TMP1 to hp_dbspi;grant select on DBA_FREE_SPACE_COALESCED_TMP2 to hp_dbspi;grant select on DBA_HISTOGRAMS to hp_dbspi;grant select on DBA_IND_COLUMNS to hp_dbspi;grant select on DBA_IND_PARTITIONS to hp_dbspi;grant select on DBA_INDEXES to hp_dbspi;grant select on DBA_JOBS to hp_dbspi;grant select on DBA_JOBS_RUNNING to hp_dbspi;grant select on DBA_LIBRARIES to hp_dbspi;grant select on DBA_LOBS to hp_dbspi;grant select on DBA_METHOD_PARAMS to hp_dbspi;grant select on DBA_METHOD_RESULTS to hp_dbspi;grant select on DBA_MVIEWS to hp_dbspi;grant select on DBA_NESTED_TABLES to hp_dbspi;grant select on DBA_OBJ_AUDIT_OPTS to hp_dbspi;grant select on DBA_OBJECT_SIZE to hp_dbspi;grant select on DBA_OBJECT_TABLES to hp_dbspi;grant select on DBA_OBJECTS to hp_dbspi;grant select on DBA_PART_COL_STATISTICS to hp_dbspi;grant select on DBA_PART_HISTOGRAMS to hp_dbspi;grant select on DBA_PART_INDEXES to hp_dbspi;grant select on DBA_PART_KEY_COLUMNS to hp_dbspi;grant select on DBA_PART_TABLES to hp_dbspi;grant select on DBA_PENDING_TRANSACTIONS to hp_dbspi;grant select on DBA_PRIV_AUDIT_OPTS to hp_dbspi;grant select on DBA_PROFILES to hp_dbspi;grant select on DBA_QUEUE_SCHEDULES to hp_dbspi;grant select on DBA_QUEUE_TABLES to hp_dbspi;grant select on DBA_QUEUES to hp_dbspi;grant select on DBA_RCHILD to hp_dbspi;grant select on DBA_REFRESH to hp_dbspi;grant select on DBA_REFRESH_CHILDREN to hp_dbspi;grant select on DBA_REFS to hp_dbspi;grant select on DBA_REGISTERED_SNAPSHOTS to hp_dbspi;grant select on DBA_REPCATLOG to hp_dbspi;grant select on DBA_RESUMABLE to hp_dbspi;grant select on DBA_RGROUP to hp_dbspi;grant select on DBA_ROLE_PRIVS to hp_dbspi;grant select on DBA_ROLES to hp_dbspi;grant select on DBA_ROLLBACK_SEGS to hp_dbspi;grant select on DBA_SEGMENTS to hp_dbspi;grant select on DBA_SEQUENCES to hp_dbspi;grant select on DBA_SNAPSHOT_LOG_FILTER_COLS to hp_dbspi;grant select on DBA_SNAPSHOT_LOGS to hp_dbspi;grant select on DBA_SNAPSHOT_REFRESH_TIMES to hp_dbspi;grant select on DBA_SNAPSHOTS to hp_dbspi;grant select on DBA_SOURCE to hp_dbspi;grant select on DBA_STMT_AUDIT_OPTS to hp_dbspi;grant select on DBA_SYNONYMS to hp_dbspi;grant select on DBA_SYS_PRIVS to hp_dbspi;grant select on DBA_TAB_COL_STATISTICS to hp_dbspi;grant select on DBA_TAB_COLUMNS to hp_dbspi;grant select on DBA_TAB_COMMENTS to hp_dbspi;grant select on DBA_TAB_HISTOGRAMS to hp_dbspi;grant select on DBA_TAB_PARTITIONS to hp_dbspi;grant select on DBA_TAB_PRIVS to hp_dbspi;grant select on DBA_TABLES to hp_dbspi;grant select on DBA_TABLESPACES to hp_dbspi;grant select on DBA_TRIGGER_COLS to hp_dbspi;grant select on DBA_TRIGGERS to hp_dbspi;grant select on DBA_TS_QUOTAS to hp_dbspi;grant select on DBA_TYPE_ATTRS to hp_dbspi;grant select on DBA_TYPE_METHODS to hp_dbspi;grant select on DBA_TYPES to hp_dbspi;grant select on DBA_UPDATABLE_COLUMNS to hp_dbspi;grant select on DBA_USERS to hp_dbspi;grant select on DBA_VIEWS to hp_dbspi;grant select on FILEXT$ to hp_dbspi;grant select on SYS.DEFTRAN to hp_dbspi;grant select on SYS.DEFERROR to hp_dbspi;grant select on SYS.FET$ to hp_dbspi;grant select on SYS.FILE$ to hp_dbspi;grant select on SYS.FILEXT$ to hp_dbspi;grant select on SYS.OBJ$ to hp_dbspi;grant select on SYS.SEG$ to hp_dbspi;grant select on SYS.SYS_DBA_SEGS to hp_dbspi;grant select on SYS.SYS_OBJECTS to hp_dbspi;grant select on SYS.TS$ to hp_dbspi;grant select on SYS.UNDO$ to hp_dbspi;grant select on SYS.USER$ to hp_dbspi;grant execute on SYS.DBMS_SPACE_ADMIN to hp_dbspi;grant select on V_$_LOCK to hp_dbspi;grant select on V_$ACCESS to hp_dbspi;grant select on V_$ACTIVE_INSTANCES to hp_dbspi;grant select on V_$AQ1 to hp_dbspi;grant select on V_$ARCHIVE to hp_dbspi;grant select on V_$ARCHIVE_DEST to hp_dbspi;grant select on V_$ARCHIVED_LOG to hp_dbspi;grant select on V_$BACKUP to hp_dbspi;grant select on V_$BACKUP_CORRUPTION to hp_dbspi;grant select on V_$BACKUP_DATAFILE to hp_dbspi;grant select on V_$BACKUP_DEVICE to hp_dbspi;grant select on V_$BACKUP_PIECE to hp_dbspi;grant select on V_$BACKUP_REDOLOG to hp_dbspi;grant select on V_$BACKUP_SET to hp_dbspi;grant select on V_$BGPROCESS to hp_dbspi;grant select on V_$BH to hp_dbspi;grant select on V_$BUFFER_POOL to hp_dbspi;grant select on V_$CIRCUIT to hp_dbspi;grant select on V_$CLASS_PING to hp_dbspi;grant select on V_$COMPATIBILITY to hp_dbspi;grant select on V_$COMPATSEG to hp_dbspi;grant select on V_$CONTROLFILE to hp_dbspi;grant select on V_$CONTROLFILE_RECORD_SECTION to hp_dbspi;grant select on V_$COPY_CORRUPTION to hp_dbspi;grant select on V_$CURRENT_BUCKET to hp_dbspi;grant select on V_$DATABASE to hp_dbspi;grant select on V_$DATAFILE to hp_dbspi;grant select on V_$DATAFILE_COPY to hp_dbspi;grant select on V_$DATAFILE_HEADER to hp_dbspi;grant select on V_$DB_OBJECT_CACHE to hp_dbspi;grant select on V_$DB_PIPES to hp_dbspi;grant select on V_$DBFILE to hp_dbspi;grant select on V_$DBLINK to hp_dbspi;grant select on V_$DELETED_OBJECT to hp_dbspi;grant select on V_$DISPATCHER to hp_dbspi;grant select on V_$DISPATCHER_RATE to hp_dbspi;grant select on V_$DLM_CONVERT_LOCAL to hp_dbspi;grant select on V_$DLM_CONVERT_REMOTE to hp_dbspi;grant select on V_$DLM_LATCH to hp_dbspi;grant select on V_$DLM_LOCKS to hp_dbspi;grant select on V_$DLM_MISC to hp_dbspi;grant select on V_$ENABLEDPRIVS to hp_dbspi;grant select on V_$ENQUEUE_LOCK to hp_dbspi;grant select on V_$EVENT_NAME to hp_dbspi;grant select on V_$EXECUTION to hp_dbspi;grant select on V_$FILE_PING to hp_dbspi;grant select on V_$FILESTAT to hp_dbspi;grant select on V_$FIXED_TABLE to hp_dbspi;grant select on V_$FIXED_VIEW_DEFINITION to hp_dbspi;grant select on V_$GLOBAL_TRANSACTION to hp_dbspi;grant select on V_$INDEXED_FIXED_COLUMN to hp_dbspi;grant select on V_$INSTANCE to hp_dbspi;grant select on V_$LATCH to hp_dbspi;grant select on V_$LATCH_CHILDREN to hp_dbspi;grant select on V_$LATCH_MISSES to hp_dbspi;grant select on V_$LATCH_PARENT to hp_dbspi;grant select on V_$LATCHHOLDER to hp_dbspi;grant select on V_$LATCHNAME to hp_dbspi;grant select on V_$LIBRARYCACHE to hp_dbspi;grant select on V_$LICENSE to hp_dbspi;grant select on V_$LOADCSTAT to hp_dbspi;grant select on V_$LOADPSTAT to hp_dbspi;grant select on V_$LOADTSTAT to hp_dbspi;grant select on V_$LOCK to hp_dbspi;grant select on V_$LOCK_ACTIVITY to hp_dbspi;grant select on V_$LOCK_ELEMENT to hp_dbspi;grant select on V_$LOCKED_OBJECT to hp_dbspi;grant select on V_$LOCKS_WITH_COLLISIONS to hp_dbspi;grant select on V_$LOG to hp_dbspi;grant select on V_$LOG_HISTORY to hp_dbspi;grant select on V_$LOGFILE to hp_dbspi;grant select on V_$LOGHIST to hp_dbspi;grant select on V_$MTS to hp_dbspi;grant select on V_$SHARED_SERVER_MONITOR to hp_dbspi;grant select on V_$MYSTAT to hp_dbspi;grant select on V_$NLS_PARAMETERS to hp_dbspi;grant select on V_$NLS_VALID_VALUES to hp_dbspi;grant select on V_$OBJECT_DEPENDENCY to hp_dbspi;grant select on V_$OFFLINE_RANGE to hp_dbspi;grant select on V_$OPEN_CURSOR to hp_dbspi;grant select on V_$OPTION to hp_dbspi;grant select on V_$PARAMETER to hp_dbspi;grant select on V_$PQ_SESSTAT to hp_dbspi;grant select on V_$PQ_SLAVE to hp_dbspi;grant select on V_$PQ_SYSSTAT to hp_dbspi;grant select on V_$PQ_TQSTAT to hp_dbspi;grant select on V_$PROCESS to hp_dbspi;grant select on V_$PWFILE_USERS to hp_dbspi;grant select on V_$QUEUE to hp_dbspi;grant select on V_$RECENT_BUCKET to hp_dbspi;grant select on V_$RECOVER_FILE to hp_dbspi;grant select on V_$RECOVERY_FILE_STATUS to hp_dbspi;grant select on V_$RECOVERY_LOG to hp_dbspi;grant select on V_$RECOVERY_PROGRESS to hp_dbspi;grant select on V_$RECOVERY_STATUS to hp_dbspi;grant select on V_$REQDIST to hp_dbspi;grant select on V_$RESOURCE to hp_dbspi;grant select on V_$RESOURCE_LIMIT to hp_dbspi;grant select on V_$ROLLSTAT to hp_dbspi;grant select on V_$ROWCACHE to hp_dbspi;grant select on V_$ROWCACHE_PARENT to hp_dbspi;grant select on V_$ROWCACHE_SUBORDINATE to hp_dbspi;grant select on V_$SESS_IO to hp_dbspi;grant select on V_$SESSION to hp_dbspi;grant select on V_$SESSION_CONNECT_INFO to hp_dbspi;grant select on V_$SESSION_CURSOR_CACHE to hp_dbspi;grant select on V_$SESSION_EVENT to hp_dbspi;grant select on V_$SESSION_LONGOPS to hp_dbspi;grant select on V_$SESSION_OBJECT_CACHE to hp_dbspi;grant select on V_$SESSION_WAIT to hp_dbspi;grant select on V_$SESSTAT to hp_dbspi;grant select on V_$SGA to hp_dbspi;grant select on V_$SGASTAT to hp_dbspi;grant select on V_$SGA_DYNAMIC_COMPONENTS to hp_dbspi;grant select on V_$SHARED_POOL_RESERVED to hp_dbspi;grant select on V_$SHARED_SERVER to hp_dbspi;grant select on V_$SORT_SEGMENT to hp_dbspi;grant select on V_$SORT_USAGE to hp_dbspi;grant select on V_$SQL to hp_dbspi;grant select on V_$SQL_BIND_DATA to hp_dbspi;grant select on V_$SQL_BIND_METADATA to hp_dbspi;grant select on V_$SQL_CURSOR to hp_dbspi;grant select on V_$SQL_SHARED_MEMORY to hp_dbspi;grant select on V_$SQLAREA to hp_dbspi;grant select on V_$SQL_PLAN to hp_dbspi;grant select on V_$SQLTEXT to hp_dbspi;grant select on V_$SQLTEXT_WITH_NEWLINES to hp_dbspi;grant select on V_$STATNAME to hp_dbspi;grant select on V_$SUBCACHE to hp_dbspi;grant select on V_$SYSSTAT to hp_dbspi;grant select on V_$SYSTEM_CURSOR_CACHE to hp_dbspi;grant select on V_$SYSTEM_EVENT to hp_dbspi;grant select on V_$SYSTEM_PARAMETER to hp_dbspi;grant select on V_$TABLESPACE to hp_dbspi;grant select on V_$THREAD to hp_dbspi;grant select on V_$TIMER to hp_dbspi;grant select on V_$TRANSACTION to hp_dbspi;grant select on V_$TRANSACTION_ENQUEUE to hp_dbspi;grant select on V_$TYPE_SIZE to hp_dbspi;grant select on V_$VERSION to hp_dbspi;grant select on V_$WAITSTAT to hp_dbspi;grant select on V$ROLLNAME to hp_dbspi;grant select on GV_$INSTANCE to hp_dbspi;grant select on V_$ROLLNAME to hp_dbspi;grant select on V_$TEMPFILE to hp_dbspi;grant select on GV_$SYSSTAT to hp_dbspi;grant select on V_$FILE_CACHE_TRANSFER to hp_dbspi;grant select on GV_$ARCHIVED_LOG to hp_dbspi;grant select on V_$ARCHIVED_LOG to hp_dbspi;grant select on GV_$ARCHIVE_DEST to hp_dbspi;grant select on V_$ARCHIVE_DEST to hp_dbspi;grant select on DBA_LOGSTDBY_PROGRESS to hp_dbspi;grant select on DBA_LOGSTDBY_LOG to hp_dbspi;grant select on V_$DATABASE to hp_dbspi;grant select on V_$ARCHIVE_DEST_STATUS to hp_dbspi;grant select on V_$RECOVERY_FILE_DEST to hp_dbspi;grant select on SYS.DEFTRAN to hp_dbspi;grant select on SYS.DEFERROR to hp_dbspi;grant select on SYS.DBA_REPCATLOG to hp_dbspi;grant select on V_$STREAMS_POOL_ADVICE to hp_dbspi;grant select on DBA_CAPTURE to hp_dbspi;grant select on DBA_PROPAGATION to hp_dbspi;grant select on DBA_APPLY to hp_dbspi;grant select on DBA_APPLY_ERROR to hp_dbspi;grant select on DBA_APPLY_PROGRESS to hp_dbspi;exit;HomeOracle 11gR2RAC ScenariosVirtualBoxAbout MeB.N.A.I.R 's Oracle blogStay updated via RSS --------------------------------------------------------------------------------Recent PostsOracle APPS Patching Oracle APPLICATIONS R12 Installation RMAN – Tablespace Point-In-Time Recovery Managing 11gR1 Grid Control – Commands, Log files & Directory Structure Oracle 11gR1 Enterprise Manager Grid Control (OEM) Installation – Part 3 Oracle 11gR1 Enterprise Manager Grid Control (OEM) Installation – Part 2 Oracle 11gR1 Enterprise Manager Grid Control (OEM) Installation – Part 1 DNS Configuration for 11gR2 SCAN & VIP crsctl start crs Vs start cluster 11gR2 Modify / Add Scan IP & Listeners Clusterware Startup Sequence Replace / Migrate OCR Create shared disks in Virtualbox Replace / Migrate Voting Disk Oracle 11gR2 RAC on VirtualBox with Role Seperation (grid & oracle) 11gR2 DataGuard Build on Oracle Restart [With data guard Broker setup] Install 11gR2 Oracle Restart (Grid Infrastructure for Standalone) on Centos 5.5 with role seperation CategoriesOracle 11gR2 Oracle Apps DBA RAC Scenarios RMAN VirtualBox February 2011 M T W T F S S « Jan Mar » 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 11gR2 Modify / Add Scan IP & ListenersPosted: Saturday in Oracle 11gR2 011gR2The current configuration of SCAN is 1 IP address (192.168.2.201) defined in /etc/hosts file. Aim is to re-configure SCAN using the 3 new IP addresses defined through DNS. New IPs addresses are 192.168.2.121, 192.168.2.122 and 192.168.2.123The current SCAN name, ‘rac-scan’ will not be changed and the three new IPs are in the same subnet as before.However, if your changes include SCAN name change and/or new IPs in different subnet, procedure to tackle these are mentioned towards the end of this post.Configuring DNS is not explained here. That’ll be posted as a separate topic.Step 1: Current ConfigurationFrom Node 1[grid@rac1 ~]$ srvctl status scanSCAN VIP scan1 is enabledSCAN VIP scan1 is running on node rac2[grid@rac1 ~]$ srvctl status scan_listenerSCAN Listener LISTENER_SCAN1 is enabledSCAN listener LISTENER_SCAN1 is running on node rac2[grid@rac1 ~]$ srvctl config scanSCAN name: rac-scan, Network: 1/192.168.2.0/255.255.255.0/eth0SCAN VIP name: scan1, IP: /rac-scan.localdomain/192.168.2.201[grid@rac1 ~]$ srvctl config scan_listenerSCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521[grid@rac1 ~]$ more /etc/hosts# Public192.168.2.101 rac1.localdomain rac1192.168.2.102 rac2.localdomain rac2# Private192.168.0.101 rac1-priv.localdomain rac1-priv192.168.0.102 rac2-priv.localdomain rac2-priv# Virtual192.168.2.111 rac1-vip.localdomain rac1-vip192.168.2.112 rac2-vip.localdomain rac2-vip# SCAN192.168.2.201 rac-scan.localdomain rac-scan[grid@rac1 ~]$Validating SCAN on second Node[grid@rac2 ~]$ srvctl status scanSCAN VIP scan1 is enabledSCAN VIP scan1 is running on node rac2[grid@rac2 ~]$ srvctl status scan_listenerSCAN Listener LISTENER_SCAN1 is enabledSCAN listener LISTENER_SCAN1 is running on node rac2[grid@rac2 ~]$ srvctl config scanSCAN name: rac-scan, Network: 1/192.168.2.0/255.255.255.0/eth0SCAN VIP name: scan1, IP: /rac-scan.localdomain/192.168.2.201[grid@rac2 ~]$ srvctl config scan_listenerSCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521Step 2: Stop SCAN and SCAN_LISTENERAs Root[grid@rac1 ~]$ srvctl stop scan_listener[grid@rac1 ~]$ srvctl stop scan[grid@rac1 ~]$ srvctl status scanSCAN VIP scan1 is enabledSCAN VIP scan1 is not running[grid@rac1 ~]$ srvctl status scan_listenerSCAN Listener LISTENER_SCAN1 is enabledSCAN listener LISTENER_SCAN1 is not running[grid@rac1 ~]$ srvctl config scanSCAN name: rac-scan, Network: 1/192.168.2.0/255.255.255.0/eth0SCAN VIP name: scan1, IP: /rac-scan.localdomain/192.168.2.201[grid@rac1 ~]$ srvctl config scan_listenerSCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521[grid@rac1 ~]$Step 3: Update /etc/hosts and enable DNS At this point, I removed the entries for VIP and SCAN from /etc/hosts file. Then I started DNS service and verified using nslookup that the 2 IPs for VIP and 3 new IPs for SCAN are working properly.Step 4: Modify / Change SCAN As ROOT[root@rac1 ~]# srvctl modify scan -n rac-scan[root@rac1 ~]# srvctl config scanSCAN name: rac-scan, Network: 1/192.168.2.0/255.255.255.0/eth0SCAN VIP name: scan1, IP: /rac-scan.localdomain/192.168.2.121SCAN VIP name: scan2, IP: /rac-scan.localdomain/192.168.2.122SCAN VIP name: scan3, IP: /rac-scan.localdomain/192.168.2.123[root@rac1 ~]# srvctl modify scan_listener –u[root@rac1 ~]# srvctl config scan_listenerSCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521Step 5: Restarting SCAN and SCAN_LISTENERAs ROOT[root@rac1 ~]# srvctl start scan[root@rac1 ~]# srvctl start scan_listenerStep 6: Validate[root@rac1 ~]# srvctl status scanSCAN VIP scan1 is enabledSCAN VIP scan1 is running on node rac2SCAN VIP scan2 is enabledSCAN VIP scan2 is running on node rac1SCAN VIP scan3 is enabledSCAN VIP scan3 is running on node rac1[root@rac1 ~]# srvctl status scan_listenerSCAN Listener LISTENER_SCAN1 is enabledSCAN listener LISTENER_SCAN1 is running on node rac2SCAN Listener LISTENER_SCAN2 is enabledSCAN listener LISTENER_SCAN2 is running on node rac1SCAN Listener LISTENER_SCAN3 is enabledSCAN listener LISTENER_SCAN3 is running on node rac1Listener.oraInstance 1[root@rac1 admin]# more $GRID_HOME/network/admin/listener.oraLISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))) # line added by AgentLISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by AgentLISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by AgentLISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON # line added by AgentInstance 2[root@rac2 admin]# more $GRID_HOME/network/admin/listener.oraLISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))) # line added by AgentLISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by AgentENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent----------------------------------------------------------------------------Change SCAN name or new IPs on different subnet?If you intend to change SCAN name, for 11.2.0.1 as root execute:# $GRID_HOME/bin/crsctl modify type ora.scan_vip.type -attr "ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=<new SCAN name>"Example: # $GRID_HOME/bin/crsctl modify type ora.scan_vip.type -attr "ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=rac-scan"Note: if you modified SCAN name, make sure to update database init.ora parameter remote_listener as well.If new SCAN IPs are in a different subnet, as root execute:# $GRID_HOME/bin/crsctl modify resource ora.net1.network -attr "USR_ORA_SUBNET=<new subnet id>" # $GRID_HOME/bin/crsctl modify resource ora.net1.network -attr "USR_ORA_NETMASK=<new subnet mask>"Example: # $GRID_HOME/bin/crsctl modify resource ora.net1.network -attr "USR_ORA_SUBNET=10.2.1.0"# $GRID_HOME/bin/crsctl modify resource ora.net1.network -attr "USR_ORA_NETMASK=255.255.255.0"Then Update and start$ $GRID_HOME/bin/srvctl modify scan_listener -u$ $GRID_HOME/bin/srvctl start scan_listenerAbout these ads Like this:Like Loading...RelatedDNS Configuration for 11gR2 SCAN & VIPIn "Oracle 11gR2"Replace / Migrate OCRIn "Oracle 11gR2"crsctl start crs Vs start clusterIn "Oracle 11gR2"Leave a Reply Cancel reply Enter your comment here... Fill in your details below or click an icon to log in:Email (required) (Address never made public) Name (required) Website You are commenting using your WordPress.com account. ( Log Out / Change )You are commenting using your Twitter account. ( Log Out / Change )You are commenting using your Facebook account. ( Log Out / Change )You are commenting using your Google+ account. ( Log Out / Change )CancelConnecting to %s Notify me of follow-up comments via email..Clusterware Startup Sequencecrsctl start crs Vs start cluster--------------------------------------------------------------------------------Blog at WordPress.com. | The Greyzed Theme. Follow Follow “B.N.A.I.R 's Oracle blog”Get every new post delivered to your Inbox.Powered by WordPress.com%d bloggers like this:===== ISSUES Worked on:1. ASYNC Descriptor , for RMAN Backup Slowness : We changed ASYNC_IO Parameter to true so that it wil not check the blocks, It Will keep on taking backup2. High CPU Utilizaion , Foud with My Query on QUERY Utilizing high CPU & done the needfull2. NODE 2 was down, So Copied BIN Folder from NODE 1 & CReated scripts to change the hostname in all the readable files & NODE came UP3. RAC Installation time, resolv.conf file was missing, UNIX Team added & Put DNS Entry in the File & RAC Installation started4. 3. WHile IMPDP TABLE_EXIST_ACTION was used automatically & Tables Structure was Skipped, Data Updated & Object CReated Timings updated in Database in DBA_OBJECTS Table, SO Used TABLE_EXIST_ACTION=REPLACE & DOne with it at that time, & Created Oracle SR for this Unusall behaviour 4. ORA-07445 for Media Failure, & Transfered the Ticket to BUR (TAPE Drive team)5. lsnrctl start : SYSTEM/6000 Error 29 Illegal SEEK : SOLUTION : Asked UNIX Team to check & Added LOCAL Entry in /etc/hosts by UNIX Team ,file 127.0.0.1 (LOOPBACK) Entry was missing #Changed /etc/hosts Perission to 666 from 664 , & Asked restart TCPIP by UNIX Team6. Solved Many INVALID Objects Issues, By Checking Proc. , Etc..7. ================================================IF STANDBY DATAFILE RECOVERY to be doneIF PROD DATAFILE RECOVERY to be doneIF SYSTEM DATAFILE RECOVERY to be doneRAC CACHE FUSION :- Cache Fusion is transfering Datas from 1 Node to another by Interconnect (Private IP Address)http://www.dba-oracle.com/t_gupta_oracle_rac_cache_fusion.htmWe know that every instance of the RAC database has its own local buffer cache which performs the usual cache functionality for that instance. Now there could be occasions when a transaction/user on instance A needs to access a data block which is being owned/locked by the other instance B. In such cases, the instance A will request instance B for that data block and hence accesses the block through the interconnect mechanism. This concept is known as CACHE FUSION where one instance can work on or access a data block in other instance?s cache via the high speed interconnect. Cache Fusion architecture helps resolve each possible type of contentions that could be thought of in a multi-node RAC setup. We will look at them in detail in coming sections but first let us understand few very important terms/concepts which will be useful in understanding the contentions which we are going to discuss in later sections. Global Cache Service Global Cache Service (GCS) is the heart of Cache Fusion concept. It is through GCS that data integrity in RAC is maintained when more than one instance need a particular data block. Instances look up to the GCS for fulfilling their data block needs.RAC BACKGROUND PROCESSLMS , LMD , LMON , LCK0 , ASM ATTRIBUTESDATAGAURD ConceptsANS :- Datagaurd is Applying Online redo logs from Prod to StandbyDatagaurd Types:ACTIVE DATAGAURD :- When Archives Applying is happening , when DB is in READ ONLY Mode. Applications Peoples can Use it for Report Purpose.PASSiVE DATAGAURD :- When Archives Applying is happening , when DB is in MOUNT Mode . Applications Peoples cannot Use it for Report Purpose.DATAGAURD CONFIGURINGExample 3-1 Primary Database: Primary Role Initialization ParametersDB_NAME=chicagoDB_UNIQUE_NAME=chicagoLOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'CONTROL_FILES='/arch1/chicago/control1.ctl', '/arch2/chicago/control2.ctl'LOG_ARCHIVE_DEST_1='LOCATION=/arch1/chicago/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES)DB_UNIQUE_NAME=chicago'LOG_ARCHIVE_DEST_2='SERVICE=boston ASYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=boston'LOG_ARCHIVE_DEST_STATE_1=ENABLELOG_ARCHIVE_DEST_STATE_2=ENABLEREMOTE_LOGIN_PASSWORDFILE=EXCLUSIVELOG_ARCHIVE_FORMAT=%t_%s_%r.arcExample 3-2 Primary Database: Standby Role Initialization ParametersFAL_SERVER=bostonDB_FILE_NAME_CONVERT='boston','chicago'LOG_FILE_NAME_CONVERT='/arch1/boston/','/arch1/chicago/','/arch2/boston/','/arch2/chicago/' STANDBY_FILE_MANAGEMENT=AUTOExample 3-3 Modifying Initialization Parameters for a Physical Standby DatabaseDB_NAME=chicagoDB_UNIQUE_NAME=bostonLOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'CONTROL_FILES='/arch1/boston/control1.ctl', '/arch2/boston/control2.ctl'DB_FILE_NAME_CONVERT='chicago','boston'LOG_FILE_NAME_CONVERT='/arch1/chicago/','/arch1/boston/','/arch2/chicago/','/arch2/boston/'LOG_ARCHIVE_FORMAT=log%t_%s_%r.arcLOG_ARCHIVE_DEST_1='LOCATION=/arch1/boston/VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston'LOG_ARCHIVE_DEST_2='SERVICE=chicago ASYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=chicago'LOG_ARCHIVE_DEST_STATE_1=ENABLELOG_ARCHIVE_DEST_STATE_2=ENABLEREMOTE_LOGIN_PASSWORDFILE=EXCLUSIVESTANDBY_FILE_MANAGEMENT=AUTOFAL_SERVER=chicagoSQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;==========================================C:\ >dbv file=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\MANA_DATA01.DBF blocksize=8192DBVERIFY: Release 10.2.0.2.0 - Production on Mon Sep 13 14:29:22 2010Copyright (c) 1982, 2005, Oracle. All rights reserved.DBVERIFY - Verification starting : FILE = C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\MANA_DATA01.DBFDBV-00200: Block, dba 17268885, already marked corruptedDBVERIFY - Verification completeTotal Pages Examined : 1685504Total Pages Processed (Data) : 1295633Total Pages Failing (Data) : 0Total Pages Processed (Index): 84554Total Pages Failing (Index): 0Total Pages Processed (Other): 29475 Total Pages Processed (Other): 29475Total Pages Processed (Seg) : 0Total Pages Failing (Seg) : 0Total Pages Empty : 275842Total Pages Marked Corrupt : 1Total Pages Influx : 0Highest block SCN : 100371677 (0.100371677)RMAN> connect target sys/****connected to target database: TAXPROD (DBID=3492187718)RMAN> BACKUP VALIDATE CHECK LOGICAL DATABASE FILESPERSET=10;Starting backup at 13-SEP-10using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: sid=485 devtype=DISKchannel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile(s) in backupsetinput datafile fno=00004 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\MANA_DATA01.DBFinput datafile fno=00005 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\MANA_NDX01.DBFinput datafile fno=00002 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\UNDOTBS01.DBFinput datafile fno=00001 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\SYSTEM01.DBFinput datafile fno=00003 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\SYSAUX01.DBFinput datafile fno=00006 name=C:\ORACLE\PRODUCT\10.2.0\ORADATA\TAXPROD\USERS01.DBFchannel ORA_DISK_1: backup set complete, elapsed time: 00:05:55Finished backup at 13-SEP-10RMAN>SQL> select * from V$DATABASE_BLOCK_CORRUPTION;FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO---------- ---------- ---------- ------------------ ---------4 491669 1 0 CORRUPTselectdbms_utility.data_block_address_file(17268885) RFN,dbms_utility.data_block_address_block(17268885) BLfrom dual;RFN BL---------- ----------4 491669select /*+ RULE CURSOR_SHARING_EXACT */substrb(dbe.owner,1,15) DB_OWNER,substrb(dbe.segment_name,1,30 ) OBJ_NAME,substrb(dbe.partition_name,1,20 ) PART_NAME,substrb(dbe.segment_type,1,3) TYP,substrb(dbe.tablespace_name,1,10) TS_NAMEfrom dba_extents dbewhere dbe.file_id = 4and 491669 between dbe.block_id and dbe.block_id+dbe.blocks-1/DB_OWNER OBJ_NAME PART_NAME TYP TS_NAME--------------- ------------------------------ -------------------- --- ----------MANA TAXINQUIRY_LOG TAB MANA_DATASQL> analyze table APEX_040000.WWV_FLOW_ACTIVITY_LOG1$ validate structure;analyze table APEX_040000.WWV_FLOW_ACTIVITY_LOG1$ validate structure*ERROR at line 1:ORA-01578: ORACLE data block corrupted (file # 7, block # 2595)ORA-01110: data file 7: '/u01/app/oracle/admin/refat/db/apex_tbs_01.dbf'SELECT SEGMENT_TYPE,OWNER||'.'||SEGMENT_NAMEFROM DBA_EXTENTS WHERE FILE_ID = *<FILE_ID>* AND *<BLOCK_NR*> BETWEEN BLOCK_IDAND BLOCK_ID+BLOCKS -1;====== RAC Short answer:1. private IP address is used only for internal clustering processing (Cache Fusion) (aka as interconnect)2. VIP is used by database applications to enable fail over when one cluster node failshttp://www.dbametrix.com/oracle-rac-vip.html3. public IP adress is the normal IP address typically used by DBA and SA to manage storage, system and database.4. SCAN Name : SCAN Name is Single Client Access Name which has Single name with 3 Virtual IP Address, SCAN Names was Introduced in 11.2 Oracle Version, ADV: Can Put single NAME in TNS ENTRY , either then adding 2 for 2 & 4 for 4 Node RAC.No need for any changes in TNS Entry in Application / Client side, incase of NODE Add / Del.We want to use Oracle ASM but not RAC on our 11gR2 (Oracle 11.2.0.3) Linux server. We have downloaded 7 zip files for complete software (database, RAC, ASM) package. p10404530_112030_Linux-x86-64_1of7.zipp10404530_112030_Linux-x86-64_2of7.zipp10404530_112030_Linux-x86-64_3of7.zipp10404530_112030_Linux-x86-64_4of7.zipp10404530_112030_Linux-x86-64_5of7.zipp10404530_112030_Linux-x86-64_6of7.zipp10404530_112030_Linux-x86-64_7of7.zipWhat is the detailed procedure of install ASM only without the clusterware? Thanks!1. unzip p10404530_112030_Linux-x86-64_1of7.zipp10404530_112030_Linux-x86-64_2of7.zipp10404530_112030_Linux-x86-64_3of7.zip2. Install Asmlib packages and configure asm disks:in http://docs.oracle.com/cd/E11882_01/install.112/e22489/typinstl.htm#BABDDFIJgo to "1.3.6 Prepare Storage for Oracle Automatic Storage Management"3. Install Grid infractructure from grid unzipped folder and choose "GI for Standalone Server"this will configure ASM4. Install database software from database unzipped folder, when creating database choose ASM for datafilesReport Abuse========================================saikrishna.loya@hp.comComputer@1234MBFS CSI :- 18421215select count(*),MODULE from v$active_session_history where sample_time between to_date('06-JUL-14 07:30','DD-MON-YY HH24:MI') and to_date('06-JUL-14 08:00','DD-MON-YY HH24:MI') group by MODULE;select count(*),MODULE from v$active_session_history where sample_time like '%JUL%' group by MODULE;select u.name USERNAME,ss.program,ss.event,ss.cnt SESSION_Count,ss.Sample_time from user$ u, (select s.user_id,count(*) cnt,to_char(s.sample_time,'dd-mon-yyyy') Sample_time,s.event,s.programfrom v$active_session_history swhere s.sample_time like '15-JUL%' group by to_char(s.sample_time,'dd-mon-yyyy'),s.user_id,s.event,s.program) sswhere u.user# = ss.user_idorder by 3;select program,count(*) cnt,to_char(sample_time,'dd-mon-yyyy') Sample_timefrom v$active_session_historywhere sample_time like '15-JUL%' group by to_char(sample_time,'dd-mon-yyyy'),programorder by 2;select user_id,event,count(*) cnt,to_char(sample_time,'dd-mon-yyyy') Sample_timefrom v$active_session_historywhere sample_time like '15-JUL%' group by to_char(sample_time,'dd-mon-yyyy'),event,user_idorder by 3;select count(*) from v$active_session_history where sample_time like '06-JUL%';@usersession:http://www.oracle.com/technetwork/issue-archive/2013/13-jan/o13dba-1871177.htmlselect user_id from dba_userswhere username = '&SAMPLE';select sample_time, session_state, event, consumer_group_idfrom v$active_session_historywhere user_id = 92and sample_time betweento_date('29-SEP-12 04.55.02 PM','dd-MON-yy hh:mi:ss PM')andto_date('29-SEP-12 05.05.02 PM','dd-MON-yy hh:mi:ss PM')and session_id = 44order by 1;-------------------------select event, count(1)from v$active_session_historywhere machine = 'prolaps01'and sample_time betweento_date('29-SEP-12 04.55.00 PM','dd-MON-yy hh:mi:ss PM')andto_date('29-SEP-12 05.05.00 PM','dd-MON-yy hh:mi:ss PM')group by eventorder by event;========================================7506736591Ronak Darji - 9820144324Chetan Mundhe - 9820263732ManojKumar Lakkakula - 9029705243drop table alert_lg1;CREATE TABLE alert_lg1(Alert_Text varchar2(3000))ORGANIZATION EXTERNAL(TYPE ORACLE_LOADERDEFAULT DIRECTORY ALERT_LGACCESS PARAMETERS(RECORDS DELIMITED BY NEWLINEFIELDS (Alert_Text CHAR(3000)))LOCATION ('alert_SFMS.log'));col ALERT_TEXT for a180col rownum for a10SELECT * FROM (SELECT rownum, alert_text FROM alert_lg1 order by 1 desc)WHERE rownum <= 20order by 1;SELECT * FROM (SELECT * FROM alert_lg1 ORDER BY ROWID DESC) WHERE ROWnum<30 order by rowid;select count(*) from alert_lg1 where ;select count(*) from alert_lg1 where rownum > 111900;between 111800 and 111956;<= 111956 and rownum >= 111900;delete archivelog all backed up 2 times to device type sbt_tape;==============================http://satya-dba.blogspot.in/2010/04/rman-commands.htmlNECS DB Configurations:RMAN> show all;RMAN configuration parameters for database with db_unique_name ORCLKHAR are:CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # defaultCONFIGURE BACKUP OPTIMIZATION OFF; # defaultCONFIGURE DEFAULT DEVICE TYPE TO DISK; # defaultCONFIGURE CONTROLFILE AUTOBACKUP OFF; # defaultCONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # defaultCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # defaultCONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # defaultCONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # defaultCONFIGURE MAXSETSIZE TO UNLIMITED; # defaultCONFIGURE ENCRYPTION FOR DATABASE OFF; # defaultCONFIGURE ENCRYPTION ALGORITHM 'AES128'; # defaultCONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # defaultCONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # defaultCONFIGURE SNAPSHOT CONTROLFILE NAME TO 'D:\APP\TCSORACLESUPPORT\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFORCL.ORA'; # defaultRMAN> CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;new RMAN configuration parameters:CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;new RMAN configuration parameters are successfully storedRMAN>##################################################################patch:-------Take the OH backup before applying this patch. $cd $ORACLE_HOME $tar –cvf /u01/oracle/ora_bin_bkup/11.1_b4psu112.tar 11.1.0 Note: If oracle home size is very huge, you can cleanup some old patch details from OH.select owner,object_name,object_type from dba_objects where status='INVALID' Ask application team to bring down all the applications belongs to the database.Stop the LISTENER$lsnrctl stop LISTENERShutdown the databaseApply the PSU Patch$opatch applyStart the database and run the below statements.SQL> CONNECT / AS SYSDBASQL> STARTUPSQL@?/rdbms/admin/catbundle.sql psu applyCompile the invalid objectsSQL>@?/rdbms/admin/utlrp.sql SELECT * FROM registry$history where ID = '6452863'; IF returns no rows, we can recompile the views, otherwise no needSQL> SHUTDOWN IMMEDIATESQL> STARTUP UPGRADESQL>@?/cpu/view_recompile/view_recompile_jan2008cpu.sqlSQL> SHUTDOWN;SQL> STARTUP;Check the invalid objects list and compare the existing taken report.Start the listenerCheck and monitor the alert logs for next few hours.Ask Application team to bring up their application.########################################################################################################################################################ALTER TABLESPACE TSCBSDATA ADD DATAFILE '+DATA' size 5G AUTOEXTEND ON MAXSIZE 30G;BREAK ON tablespace_name SKIP 2COMPUTE SUM OF allocated_bytes, free_bytes ON tablespace_nameCOLUMN allocated_bytes FORMAT 9,999,999,999COLUMN free_bytes FORMAT 9,999,999,999SELECT a.tablespace_name, a.file_name, a.bytes allocated_bytes,b.free_bytesFROM dba_data_files a,(SELECT file_id, SUM(bytes) free_bytesFROM dba_free_space b GROUP BY file_id) bWHERE a.file_id=b.file_idORDER BY a.tablespace_name;=================================@rtbs:-----set lines 132 set pages 105set pause offset echo offset feedb oncolumn "TOTAL ALLOC (GB)" format 9,999,990.00column "TOTAL PHYS ALLOC (GB)" format 9,999,990.00column "USED (GB)" format 9,999,990.00column "FREE (GB)" format 9,999,990.00column "% USED" format 990.00select a.tablespace_name,a.bytes_alloc/(1024*1024*1024) "TOTAL ALLOC (GB)",a.physical_bytes/(1024*1024*1024) "TOTAL PHYS ALLOC (GB)",nvl(b.tot_used,0)/(1024*1024*1024) "USED (GB)",(nvl(b.tot_used,0)/a.bytes_alloc)*100 "% USED"from (select tablespace_name,sum(bytes) physical_bytes,sum(decode(autoextensible,'NO',bytes,'YES',maxbytes)) bytes_allocfrom dba_data_filesgroup by tablespace_name ) a,(select tablespace_name, sum(bytes) tot_usedfrom dba_segmentsgroup by tablespace_name ) bwhere a.tablespace_name = b.tablespace_name (+)and a.tablespace_name not in (select distinct tablespace_name from dba_temp_files)--and -- a.tablespace_name not like 'UNDO%'order by 1;TABLESPACE_NAME TOTAL ALLOC (GB) TOTAL PHYS ALLOC (GB) USED (GB) % USED------------------------------ ---------------- --------------------- ------------- -------SYSAUX 2.00 1.56 1.48 74.17SYSTEM 2.00 0.83 0.78 38.84TSCBSDATA 90.00 40.68 9.73 10.81TSCBSIDX 30.00 12.91 3.00 9.99USERS 0.00 0.00 0.00 0.00set line 180col file_name for a55col TABLESPACE_NAME for a25set pages 100set verify off select df.FILE_ID,df.FILE_NAME,df.TABLESPACE_NAME,round(df.BYTES/1024/1024) Allocated,round(nvl(dfs.BYTES/1024/1024,0)) FREE_SPACE, round(((df.BYTES/1024/1024)-nvl((dfs.BYTES/1024/1024),0))) USED_SPACEfrom dba_data_files df,(select file_id,tablespace_name,sum(bytes) bytesfrom dba_free_spacegroup by file_id,tablespace_name) dfswhere df.FILE_ID=dfs.FILE_ID (+)--AND df.TABLESPACE_NAME in('TABLESPACE_NAME')order by df.FILE_ID; ============================col name for a10SELECTNAME,TO_CHAR( (SPACE_LIMIT)/1024/1024/1024, '9999999999999') AS "SPACE_LIMIT in GB",TO_CHAR((SPACE_LIMIT - SPACE_USED + SPACE_RECLAIMABLE)/1024/1024/1024, '9999999999999')AS "SPACE_AVAILABLE in GB",To_CHAR((SPACE_USED)/1024/1024/1024, '9999999999999') AS "SPACE_USED in GB" ,ROUND((SPACE_USED - SPACE_RECLAIMABLE)/SPACE_LIMIT * 100, 1)AS PERCENT_FULLFROM V$RECOVERY_FILE_DEST ;NAME SPACE_LIMIT in SPACE_AVAILABL SPACE_USED in PERCENT_FULL---------- -------------- -------------- -------------- ------------+FRA 200 189 11 5.3 =====column Name format a17SELECT Name, (SPACE_LIMIT/1024/1024/1024) Space_Limit_GB, SPACE_USED/1024/1024/1024 Space_Used_GB, SPACE_RECLAIMABLE, NUMBER_OF_FILES FROM V$RECOVERY_FILE_DEST; NAME SPACE_LIMIT_GB SPACE_USED_GB SPACE_RECLAIMABLE NUMBER_OF_FILES----------------- -------------- ------------- ----------------- ---------------+FRA 200 10.6416016 0 105==set linesize 100select * from V$RECOVERY_AREA_USAGE;FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES-------------------- ------------------ ------------------------- ---------------CONTROL FILE 0 0 0REDO LOG 0 0 0ARCHIVED LOG 5.2 0 94BACKUP PIECE .13 0 11IMAGE COPY 0 0 0FLASHBACK LOG 0 0 0FOREIGN ARCHIVED LOG 0 0 0 =======================================================select file_name, bytes, maxbytes,increment_by*(bytes/blocks) "INCREMENT",maxbytes-bytes remaining,(maxbytes-bytes)/(increment_by*(bytes/blocks)) EXTENSIONSfrom dba_data_fileswhere autoextensible = 'YES' ; ================================= FNSONLS.INVMcolumn "Percent of Total Disk Usage" justify right format 999.99 column "Space Used (MB)" justify right format 9,999,999.99 column "Total Object Size (MB)" justify right format 9,999,999.99 set linesize 150 set pages 80 set feedback off select * from (select to_char(end_interval_time, ‘MM/DD/YY’) mydate, sum(space_used_delta) / 1024 / 1024 "Space used (MB)", avg(c.bytes) / 1024 / 1024 "Total Object Size (MB)", round(sum(space_used_delta) / sum(c.bytes) * 100, 2) "Percent of Total Disk Usage" from dba_hist_snapshot sn, dba_hist_seg_stat a, dba_objects b, dba_segments c where begin_interval_time > trunc(sysdate) – &days_back and sn.snap_id = a.snap_id and b.object_id = a.obj# and b.owner = c.owner and b.object_name = c.segment_name and c.segment_name = ‘segment_name’ group by to_char(end_interval_time, ‘MM/DD/YY’)) order by to_date(mydate, ‘MM/DD/YY’);=========================UNDO space checkcolumn file_name format a55column tablepsace_name format a22set pages 200set lines 200select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where tablespace_name like '%&UNDO%' ;set time oncolumn host_name format a25select name,open_mode from gv$database;select host_name,status,logins from gv$instance;set pages 500set lines 120set heading oncolumn tablespace_name for a30column tbsize for 999999999.999column tbfree for 999999999.999column Largest for 99999.999column ratio for 9999.99column Required for 99999.999selecta.tablespace_name ,tbsize ,tbfree ,b.tbfree/a.tbsize*100 "% Free TBS" ,b.Largest "Largest space"from( select tablespace_name,sum(bytes)/1024/1024 tbsizefrom dba_data_filesgroup by tablespace_name) a,( select tablespace_name,nvl(sum(bytes)/1024/1024,0) tbfree,nvl(max(bytes)/1024/1024,0) Largestfrom dba_free_spacegroup by tablespace_name) bwhere a.tablespace_name = b.tablespace_name(+)TABLESPACE_NAME TBSIZE TBFREE % Free TBS Largest space------------------------------ -------------- -------------- ---------- -------------SFMS_BR_ARCH_NDX 12288.000 11751.625 95.6349691 3968UNDOTBS1 20480.000 19190.438 93.7033081 3968SFMS_BR_ARCH_DATA 168759.000 147594.125 87.4585207 3968USERS 800.000 686.625 85.828125 499UNDOTBS2 66881.000 43030.063 64.3382463 3968SYSTEM 2500.000 1547.438 61.8975 1547SYSAUX 6144.000 1815.375 29.5471191 750SFMS_BR_NDX 19732.000 5308.063 26.900783 1605SFMS_BR_DATA 197295.000 24109.125 12.2198358 3968select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_temp_files;select file_id,tablespace_name,file_name,bytes/1024/1024,maxbytes/1024/1024,autoextensible from dba_data_files where tablespace_name=============================================undo usage query by session := col osuser for a15col user for a10col undo_tbs for a12col SEGMENT_NM for a15col command for a30set pages 9999set lines 200SELECT ds.TABLESPACE_NAME "UNDO_TBS",ds.RELATIVE_FNO "File Nos",r.name "SEGMENT_NM", s.sid, s.serial#,s.osuser, s.username "USER", t.status,t.cr_get, t.phy_io, t.used_ublk, t.noundo,substr(s.program, 1, 78) "COMMAND", c.sql_textFROM sys.v_$session s, sys.v_$transaction t, sys.v_$rollname r,dba_segments ds,v$sql cWHERE t.addr = s.taddrand t.xidusn = r.usnand s.sql_hash_value = c.hash_valueand ds.segment_name = r.name(+)--and s.program not like 'ORACLE.EXE%'ORDER BY t.cr_get, t.phy_io;UNDO_TBS File Nos SEGMENT_NM SID SERIAL# OSUSER USER STATUS CR_GET PHY_IO USED_UBLK NOU COMMAND------------ ---------- --------------- ---------- ---------- --------------- ---------- ---------------- ---------- ---------- ---------- --- ------------------------------SQL_TEXT--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------UNDOTBS2 5 _SYSSMU401_2783 61 29 oracle SFMSBR ACTIVE 56371674 1970139 42916 NO sqlplus@P25O.localdomain (TNS765022$ V1-V3)DELETE FROM SMD_SYS_MSG_DTLS WHERE TO_DATE(SMD_CRTN_DATE) = :B1======== For UsingTempset lines 400set pages 9999col sid_serial for a12col program for a30col event for a40col username for a15col tablespace for a15col status for a10SELECT a.inst_id,a.sid||','||a.serial# SID_SERIAL, to_char(a.logon_time,'dd-mm-yyyy hh24:mis'),a.program,a.event,(sum(b.extents)*1024*1024)/1024/1024 MB_space,b.tablespace tablespace,a.sql_hash_value,a.username, a.osuser, c.spid Process,a.status --,'alter system kill session ''' || a.sid || ',' || a.serial# || ''' immediate;' "sids"FROM gv$session a,gv$sort_usage b, gv$process c, dba_tablespaces dWHERE a.saddr = b.session_addrAND a.paddr = c.addrAND b.tablespace=d.tablespace_name -- and schemaname not like '%SYS%'and b.extents*1024*1024 > 1000group by a.username, a.osuser, a.sid||','||a.serial#,c.spid,b.tablespace, a.status,a.program,a.event, a.inst_id,a.logon_time,a.sid,a.serial#,a.sql_hash_value order by MB_space asc,a.logon_time asc;@changeawr:----------Then, execute the following command to create a manual snapshot.EXECUTE dbms_workload_repository.create_snapshot();Then wait for 30 min ( or required time period ) and create another manual snapshot by following command.EXECUTE dbms_workload_repository.create_snapshot();execute dbms_workload_repository.modify_snapshot_settings(interval => 60,retention => 20160);========PARTION===========@partselect PARTITION_NAME,TABLESPACE_NAME,HIGH_VALUE from DBA_TAB_PARTITIONS where TABLE_NAME='&MHB_MSG_HDR_BR_AR';=====ls -lrt 1_10[5-8]*=========================************************************************************=========================================find . -type f -name "*.aud" -mtime +15 -exec rm -rf {} \;========================================http://select-star-from.blogspot.in/search/label/ISSUEORA-16191: Primary log shipping client not logged on standby==============pdc backuprun{allocate channel c1 device type disk;allocate channel c2 device type disk;allocate channel c3 device type disk;backup as compressed backupset database format 'E:\RMANCOLDBKP\db_%d_%D_%M_%Y_%s.bkp';backup current controlfile format 'E:\RMANCOLDBKP\ctl_%d_%D_%M_%Y_%s.bkp';release channel c1;release channel c2;release channel c3;}===================https://sites.google.com/site/oraclerac009/rac-q-a=============================ls -ltr *0402* | awk '{print $5,$NF}'select PARTITION_NAME,TABLESPACE_NAME,HIGH_VALUE from DBA_TAB_PARTITIONS where TABLE_NAME='MST_MSG_STOR_TBL_AR';======================hashvalSELECT sql_textFROM V$SQLTEXTWHERE hash_value = 228801498ORDER BY piece;################################################################################################################################################################################################################dlp:===*************Script to get objects info of an owner***********************************select object_type,count(*) from dba_objects where owner='ENFOS' group by object_type;select owner,object_type,count(*) from dba_objects group by object_type,owner order by owner;set linesize 100 pages 100col owner for a10col object_name for a20col object_type for a15select owner,object_name,object_type,status from dba_objects where object_name='TEST';[Query to find object count,object type]set pages 4999 linesize 300col owner for a20col object_name for a25col object_type for a25select owner,count(*),object_type from dba_objects group by owner,object_type order by 1;[Query to find object/schema size]select owner,sum(bytes)/(1024*1024) "BYTES IN MB" from dba_segments group by owner;===========================================================================================================================******************************Script to get the DDL to create objects in Database******************set heading off;set echo off;Set pages 999;set long 90000;select dbms_metadata.get_ddl('TABLESPACE','AV78H1IS_1996') from dual;===========================================================================================================================*****************************Freespace Scripts****************************************************Datafiles in Tablespace:-------------------------select distinct status from v$backup;col file_name for a55set pages 100select file_name,bytes/1024/1024 from dba_data_files where tablespace_name='&tablespace_name';Freespace For a tablespace only:-------------------------------COL TS_NAME FOR A20COL AVAILABLE FOR A15COL USED FOR A15COL FREE FOR A15set linesize 300select a.tablespace_name TS_NAME,a.bytes/1024/1024||' MB' AVAILABLE,b.bytes/1024/1024||' MB' USED,c.bytes/1024/1024||' MB' FREEfrom sm$ts_avail a,sm$ts_used b,sm$ts_free c where a.tablespace_name=b.tablespace_name and b.tablespace_name=c.tablespace_name and a.tablespace_name='REFIND1';---------------------------------------------------------------------------------------------------------------------------Freespace in tablespace with Datafiles:--------------------------------------SET LINESIZE 300SET PAGESIZE 60COL TABLESPACE_NAME FOR A28COL FILE_NAME FOR A55COL TOTAL FOR A10COL FREE FOR A10SELECT dd.tablespace_name TABLESPACE_NAME,dd.file_name FILE_NAME,dd.bytes/1024/1024||' MB' TOTAL,SUM(fs.bytes)/1024/1024||' MB' FREEFROM sys.dba_free_space fs, sys.dba_data_files ddWHERE dd.tablespace_name = fs.tablespace_nameAND dd.file_id = fs.file_id GROUP BY dd.tablespace_name, dd.file_name, dd.bytes/1024ORDER BY dd.tablespace_name, dd.file_name;---------------------------------------------------------------------------------------------------------------------------Freespace in Temporary tablespace:---------------------------------select TABLESPACE_NAME,sum(BYTES_USED)/1024/1024,sum(BYTES_FREE)/1024/1024 from v$temp_space_header group by tablespace_name;col tablespace_name for a20col USED_MB for 99999999col FREE_MB for 99999999set linesize 300select tablespace_name,sum(bytes_used)/1024/1024 used_mb,sum(bytes_free)/1024/1024 free_mb from v$temp_space_header group by tablespace_name;select name from v$tempfile;select file_name,bytes/1024/1024 from dba_temp_files where tablespace_name='TEMP';---------------------------------------------------------------------------------------------------------------------------Freespace in all the tablespaces:--------------------------------COLUMN pct_free FORMAT 999.99 HEADING "% Free" COLUMN name FORMAT A16 HEADING "Tablespace Name" COLUMN mbytes FORMAT 99,999,999 HEADING "Total MBytes" COLUMN used FORMAT 99,999,999 HEADING "Used Mbytes" COLUMN free FORMAT 99,999,999 HEADING "Free Mbytes" BREAK ON REPORTCOMPUTE SUM OF mbytes ON REPORT COMPUTE SUM OF free ON REPORT COMPUTE SUM OF used ON REPORT SELECT fs.tablespace_name name, df.totalspace mbytes, (df.totalspace - fs.freespace) used, fs.freespace free, 100 * (fs.freespace / df.totalspace) pct_free FROM (SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) TotalSpace FROM dba_data_files GROUP BY tablespace_name ) df,(SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) FreeSpace FROM dba_free_space GROUP BY tablespace_name ) fsWHERE df.tablespace_name = fs.tablespace_name(+);set pages 49999 linesize 200select nvl(b.tablespace_name,nvl(a.tablespace_name,'UNKOWN')) "TablespaceName",kbytes_alloc "AllocatedSpace(MB)",kbytes_alloc-nvl(kbytes_free,0) "UsedSpace(MB)",nvl(kbytes_free,0) "FreeSpace(MB)",((kbytes_alloc-nvl(kbytes_free,0))/kbytes_alloc)*100 " %Used "from ( select sum(bytes)/1024/1024 Kbytes_free,max(bytes)/1024/1024 largest,tablespace_namefrom sys.dba_free_spacegroup by tablespace_name ) a,( select sum(bytes)/1024/1024 Kbytes_alloc,tablespace_namefrom sys.dba_data_filesgroup by tablespace_name )bwhere a.tablespace_name (+) = b.tablespace_nameand a.tablespace_name='AV78C1TS';----------------------------------------------------------------------------------------------------------------------------Add Datafile Check:------------------select name from v$datafile where name like '%ops_stg_tab_36%';ls -ltr /dba*/DBF/cseblpr2/eim_im06*---------------------------------------------------------------------------------------------------------------------------Tablespaces Freespace Report:--------------------------------set linesize 1000set trimspool onset pagesize 32000set verify offset feedback offSELECT df.tablespace_name tsname, sum(df.bytes)/1024/1024 tbs_size_mb, nvl(sum(e.used_bytes)/1024/1024,0) used, nvl(sum(f.free_bytes)/1024/1024,0) avail, rpad(' '||rpad('X',round(sum(e.used_bytes)*10/sum(df.bytes),0), 'X'),11,'-') used_visual, nvl((sum(e.used_bytes)*100)/sum(df.bytes),0) pct_usedFROM sys.dba_data_files df, (SELECT file_id, sum(nvl(bytes,0)) used_bytesFROM sys.dba_extentsGROUP BY file_id) e, (SELECT max(bytes) free_bytes, file_idFROM dba_free_spaceGROUP BY file_id) fWHERE e.file_id(+) = df.file_idAND df.file_id = f.file_id(+)GROUP BY df.tablespace_nameORDER BY 6/---------------------------------------------------------------------------------------------------------------------------Freespace in Datafiles in a Database:--------------------------------------set linesize 1000set trimspool onset pagesize 32000set verify offset feedback offcolumn tsname format a20 heading 'Tablespace Name'column flname format a50 heading 'Filename'column siz format 999,999,990 heading 'File Size|(MB)'column maxsiz format 999,999,990 heading 'Max Size|(MB)'column pctmax format 990 heading 'Pct|Max'select file_name flname, tablespace_name tsname, bytes/1024/1024 siz, decode(maxbytes,0,0,maxbytes/1024/1024) maxsiz, decode(maxbytes,0,0,bytes/maxbytes*100) pctmaxfrom dba_data_files/==========================================================================================================================================******************Database Startup time***********************************select instance_name,status,to_char(startup_time,'DD/MM/YYYY HH24:MM:SS') from v$instance;select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') from dual;==========================================================================================================================================********************************Script Execution***************************************************vi stats.sqlconn ra/p8rick;set timing onset verify onset feedback on head onset echo onspool stats.logselect name from v$database;show user;exec dbms_stats.gather_schema_stats('WCADMIN');spool off;exit;==========================================================================================================================================***********************************User Account Scripts************************************************set lines 200 set pages 1000select USERNAME,PASSWORD,ACCOUNT_STATUS,EXPIRY_DATE from dba_users where username in ('CSHEKA','RPEDDI','PCHAKR','ASHAST,'RMAHAL');select username,account_status from dba_users where username like '******';select TEMPORARY_TABLESPACE,count(1) from dba_users group by TEMPORARY_TABLESPACE;select DEFAULT_TABLESPACE,count(1) from dba_users group by DEFAULT_TABLESPACE;select count(*) from dba_users;CREATE USER CSHEKA IDENTIFIED BY nike123DEFAULT TABLESPACE USERSTEMPORARY TABLESPACE TEMP;===========================================================================================================================================**********************************Max Extents for Table/Index**********************************************select owner,table_name,MAX_EXTENTS from dba_tables where table_name='MLOG$_CMFP';alter table NIKE.NICLRTX storage(maxextents 500);select OWNER,INDEX_NAME,MAX_EXTENTS from dba_indexes where index_name='*******';alter index KORODS.LCUSTPX0 storage(maxextents 200);===========================================================================================================================================*********************************Gather Statistics/Stats****************************************************Tables:SELECT DISTINCT(TRUNC(LAST_ANALYZED)),COUNT(1) from dba_tables where owner='SYSADM' GROUP BY TRUNC(LAST_ANALYZED);select owner,table_name, LAST_ANALYZED from dba_tables where LAST_ANALYZED<=sysdate-7;EXEC DBMS_STATS.gather_schema_stats(ownname => 'SYSADM', estimate_percent => 10);EXEC DBMS_STATS.gather_schema_stats('SYSADM');analyze table SYSADM."PSAPMSGPUBDATA" compute statistics;Indexes:SELECT DISTINCT(TRUNC(LAST_ANALYZED)),COUNT(1) from dba_indexes where owner='SYSADM' GROUP BY TRUNC(LAST_ANALYZED);select owner,index_name from dba_indexes where last_analyzed<=sysdate-7;analyze index sysadm."PS_PSAPMSGPUBDATA" compute statistics;spool stats_gather.logselect name from v$database;show user;set timing on;EXEC DBMS_UTILITY.analyze_schema('SYSADM','ESTIMATE', estimate_percent => 10);spool off;set timing off;exit;==========================================================================================================================================*****************************Schema Analyze********************************EXEC DBMS_UTILITY.analyze_schema('TEST','COMPUTE');EXEC DBMS_UTILITY.analyze_schema('TEST','ESTIMATE', estimate_percent => 10);=============================================================================================================================================******************************Kill Sesion{gadmp}********************************************************************To get Server Process Id(SPID) using the oracle session id (sid):@getpid:------select spid from v$process where background is null and addr in (select paddrfrom v$sessionwhere sid=&session_id);@getsid:------select sid from v$sessionwhere paddr in (select addrfrom v$processwhere spid=&sp_id);select sid,serial# from v$session where sid=***;ps -ef|grep spidalter system kill session 'sid,serial#';Eg: alter system kill session '815,4221';select sid,serial#,status from v$session where sid=***;ps -ef|grep spidkill -9 spidselect sid,serial#,status from v$session where sid=***;=============================================================================================================================================********************To View all the views************************************************************select tname from tab where tname like '%JOB%';=============================================================================================================================================********************************Session Monitoring Scripts*******************************************Session Monitoring Scripts--All the Sessions--------------------------------------------SET LINESIZE 500SET PAGESIZE 1000COLUMN username FORMAT A10COLUMN osuser FORMAT A10COLUMN SID for 99999COLUMN SERIAL# for 99999COLUMN SPID for 99999COLUMN lockwait FORMAT A18COLUMN status FORMAT A10COLUMN module FORMAT A15COLUMN machine FORMAT A15COLUMN program FORMAT A15SELECT NVL(s.username, '(oracle)') AS username,s.osuser,s.sid,s.serial#,p.spid,s.lockwait,s.status,s.module,s.machine,s.program,TO_CHAR(s.logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time FROM v$session s,v$process p WHERE s.paddr = p.addr; Session Monitoring Scripts--Active Sessions-------------------------------------------set linesize 500 pages 49999col username for a15col status for a10col schemaname for a15col osuser for a10col process for 99999col program for a35SELECT SID,SERIAL#,USERNAME,STATUS,SCHEMANAME,OSUSER,PROCESS,PROGRAM,PQ_STATUS "PARALLEL",TO_CHAR(LOGON_TIME,'DD-MM-YYYY HH24:MI:SS')FROM V$SESSION ;WHERE TYPE <>'BACKGROUND'AND STATUS='ACTIVE';Details os SQL executed currently by an SID-------------------------------------------SELECT b.sid,b.username,a.SQL_TEXT,a.ROWS_PROCESSED FROM V$SQL a, v$session bWHERE a.address = b.sql_address AND a.hash_value = b.sql_hash_value AND b.sid in ('1421');=============================================================================================================================================***************************************Privileges to a user**********************************---------------------------------------------------------------------------------------------GRANTEEUser to whom access was grantedOWNEROwner of the objectTABLE_NAMEName of the objectGRANTORName of the user who performed the grantPRIVILEGETable PrivilegeGRANTABLEPrivilege is grantableHIERARCHYPrivilege is with hierarchy option--------------------------------------------------------------------------------------------set linesize 500 pages 49999col grantee for a20col owner for a20select * from dba_tab_privs where GRANTEE='******';============================================================================================================================================= ***********************************Segment Information for a Tablespace******************************* set linesize 500 pages 49999col owner a25col segment_name for a30select owner,segment_name,segment_type from dba_segments where tablespace_name='******';=============================================================================================================================================************************************List of Invalid Objects in the Database*****************************SET LINESIZE 145SET PAGESIZE 9999clear columnsclear breaksclear computescolumn owner format a25 heading 'Owner'column object_name format a30 heading 'Object Name'column object_type format a20 heading 'Object Type'column status format a10 heading 'Status'break on owner skip 2 on reportcompute count label "" of object_name on ownercompute count label "Grand Total: " of object_name on reportSELECTowner, object_name, object_type, statusFROM dba_objectsWHERE status <> 'VALID'and owner not in ('SYS','SYSTEM','DBSNMP')ORDER BY owner, object_name/=============================================================================================================================================************************************Online Backup status of Datafiles*****************************column "File No" format 9999 wrappedcolumn "File Name" format a50 wrappedcolumn "Size (bytes)" format 99999999999 wrappedcolumn "Backup Status" format a10 wrapped heading "Backup|Status"column "Start Time" format a18 wrappedset linesize 1000set pagesize 32000set trimspool onselect b.file# "File No", d.name "File Name", d.bytes "Size (bytes)", b.status "Backup Status", to_char(b.time,'DD-MON-YY HH24:MI:SS') "Start Time"from v$backup b, v$datafile dwhere b.file# = d.file#order by b.time/column "File No" clearcolumn "File Name" clearcolumn "Size (bytes)" clearcolumn "Backup Status" clearcolumn "Start Time" clear=============================================================================================================================================************************************Growth of Database*****************************#Provides a report on physical database growth with respect to the date that data files have been added.@monthlygrowth----------------SET LINESIZE 145SET PAGESIZE 9999SET VERIFY OFFCOLUMN month FORMAT a7 HEADING 'Month'COLUMN growth FORMAT 999,999,999,999,999 HEADING 'Growth (MB)'BREAK ON reportCOMPUTE SUM OF growth ON reportSELECTTO_CHAR(creation_time, 'RRRR-MM') month, SUM(bytes)/1024/1024 growthFROM sys.v_$datafileGROUP BY TO_CHAR(creation_time, 'RRRR-MM')ORDER BY TO_CHAR(creation_time, 'RRRR-MM');=============================================================================================================================================************************************Query all the tables within a Schema*****************************SET LINESIZE 145SET PAGESIZE 9999COLUMN owner FORMAT A15 HEADING "Owner"COLUMN table_name FORMAT A30 HEADING "Table Name"COLUMN tablespace_name FORMAT A28 HEADING "Tablespace"COLUMN last_analyzed FORMAT A20 HEADING "Last Analyzed"COLUMN num_rows FORMAT 999,999,999 HEADING "# of Rows"SELECTowner, table_name, tablespace_name, TO_CHAR(last_analyzed, 'DD-MON-YYYY HH24:MI:SS') last_analyzed, num_rowsFROM all_tablesWHERE owner = UPPER('&owner')ORDER BY owner, table_name/=============================================================================================================================================@archgen************************************Query to find out number of arch files generated every hour*****************************set lines 120; set pages 999; SELECT to_char(first_time,'YYYY-MON-DD') day,to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'99') "00",to_char(sum(decode(to_char(first_time,'HH24'),'01',1,0)),'99') "01",to_char(sum(decode(to_char(first_time,'HH24'),'02',1,0)),'99') "02",to_char(sum(decode(to_char(first_time,'HH24'),'03',1,0)),'99') "03",to_char(sum(decode(to_char(first_time,'HH24'),'04',1,0)),'99') "04",to_char(sum(decode(to_char(first_time,'HH24'),'05',1,0)),'99') "05",to_char(sum(decode(to_char(first_time,'HH24'),'06',1,0)),'99') "06",to_char(sum(decode(to_char(first_time,'HH24'),'07',1,0)),'99') "07",to_char(sum(decode(to_char(first_time,'HH24'),'08',1,0)),'99') "08",to_char(sum(decode(to_char(first_time,'HH24'),'09',1,0)),'99') "09",to_char(sum(decode(to_char(first_time,'HH24'),'10',1,0)),'99') "10",to_char(sum(decode(to_char(first_time,'HH24'),'11',1,0)),'99') "11",to_char(sum(decode(to_char(first_time,'HH24'),'12',1,0)),'99') "12",to_char(sum(decode(to_char(first_time,'HH24'),'13',1,0)),'99') "13",to_char(sum(decode(to_char(first_time,'HH24'),'14',1,0)),'99') "14",to_char(sum(decode(to_char(first_time,'HH24'),'15',1,0)),'99') "15",to_char(sum(decode(to_char(first_time,'HH24'),'16',1,0)),'99') "16",to_char(sum(decode(to_char(first_time,'HH24'),'17',1,0)),'99') "17",to_char(sum(decode(to_char(first_time,'HH24'),'18',1,0)),'99') "18",to_char(sum(decode(to_char(first_time,'HH24'),'19',1,0)),'99') "19",to_char(sum(decode(to_char(first_time,'HH24'),'20',1,0)),'99') "20",to_char(sum(decode(to_char(first_time,'HH24'),'21',1,0)),'99') "21",to_char(sum(decode(to_char(first_time,'HH24'),'22',1,0)),'99') "22",to_char(sum(decode(to_char(first_time,'HH24'),'23',1,0)),'99') "23"fromv$log_historyGROUP by to_char(first_time,'YYYY-MON-DD') order by day asc;============================================================================================================================================2nd---alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';select trunc(first_time, 'HH') , count(*)from v$loghistgroup by trunc(first_time, 'HH') order by trunc(first_time, 'HH');=============================================================================================================================================************************************Query to find out number of DBLINKS*****************************set pages 100set linesize 800col owner for a20col db_link for a30col username for a20col host for a20select * from dba_db_links where db_link='SWFTW_DDL';=============================================================================================================================================************************************Crontab entries in UNIX****************************** * * * * command to be executed- - - - -| | | | || | | | +----- day of week (0 - 6) (Sunday=0)| | | +------- month (1 - 12)| | +--------- day of month (1 - 31)| +----------- hour (0 - 23)+------------- min (0 - 59)=============================================================================================================================================***********************************EXTENTS***********************************SQL> select owner,table_name,MAX_EXTENTS from dba_tables where table_name='NICLRTX';OWNER TABLE_NAME MAX_EXTENTS------------------------------ ------------------------------ -----------NIKE NICLRTX 249SQL> alter table NIKE.NICLRTX storage(maxextents 500);Table altered.=============================================================================================================================================***********************************Sapreorg/Saparch***********************************bdf|grep %|grep archls -ltr /oracle/BIP/sapreorg/ARCH_SPLIT/sap*ls -altr /oracle/PTA/sapreorg/seb*/*.newls -altr /oracle/PTA/sapreorg/seb*/*.oldnohup compress /oracle/PTA/sapreorg/seb*/*.new &nohup compress /oracle/PTA/sapreorg/seb*/*.old &=============================================================================================================================================***********************************High Water Mark(HVM)***********************************@watermarkset verify offcolumn file_name format a50 word_wrappedcolumn smallest format 999,990 heading "Smallest|Size|Poss."column currsize format 999,990 heading "Current|Size"column savings format 999,990 heading "Poss.|Savings"break on reportcompute sum of savings on reportcolumn value new_val blksizeselect value from v$parameter where name = 'db_block_size';select file_name, hwm, bytes/1024/1024,blocks total_blocks, ((blocks-hwm+1)*(&&blksize) )/1024/1024 shrinkage_possible_MBfrom dba_data_files a, ( select file_id, max(block_id+blocks) hwmfrom dba_extents group by file_id ) bwhere a.file_id = b.file_idand a.tablespace_name='&tbs';SIZE TO BE SHRINKED IS shrinkage_possible*db_block_size ( in bytes)=============================================================================================================================================**********************************Tuning Queries******************************************SELECT distinct b.sid,b.username,a.SQL_TEXT,a.ROWS_PROCESSED--,a.SQL_ID FROM V$SQL a, v$session bWHERE a.address = b.sql_address AND a.hash_value = b.sql_hash_value;set linesize 500 pages 49999col username for a15col status for a10col schemaname for a15col osuser for a12col process for 99999col program for a35SELECT SID,SERIAL#,USERNAME,STATUS,SCHEMANAME,OSUSER,PROCESS,PROGRAM,PQ_STATUS "PARALLEL",TO_CHAR(LOGON_TIME,'DD-MM-YYYY HH24:MI:SS')FROM V$SESSION where SID in (165);;WHERE TYPE <>'BACKGROUND'AND USERNAME='BRIOSVR_BATCH';--where sid ='1009';set linesize 800 pages 49999set lines 1000col USERNAME for a14col status for a10col schemaname for a15col OSUSER for a15col process for 99999col program for a12SELECT SID,SERIAL#,USERNAME,STATUS,SCHEMANAME,OSUSER,PROCESS,PROGRAM,TO_CHAR(LOGON_TIME,'DD-MM-YYYY HH24:MI:SS')FROM V$SESSION WHERE SID=93;WHERE TYPE <>'BACKGROUND'AND USERNAME='BRIOSVR_BATCH';select * from v$sess_io where sid ='57';COLUMN sid FORMAT 999,99999COLUMN serial# FORMAT 9999999COLUMN machine FORMAT A15COLUMN OPNAME FOR A45COLUMN progress_pct FORMAT 99999999.00COLUMN elapsed FORMAT A10COLUMN remaining FORMAT A20COLUMN REM_MIN FOR A10set linesize 300SELECT distinct s.username,s.sid,s.serial#,sl.opname,s.machine,sl.SOFAR,sl.TOTALWORK,TRUNC(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,TRUNC(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) REM_MIN--ROUND(sl.sofar/sl.totalwork*100, 2) progress_pctFROM v$session s,v$session_longops slWHERE s.sid = sl.sidAND s.serial# = sl.serial#and s.username='OPS$ORACLE'and sl.sofar<>sl.totalwork;SET LINESIZE 200SET PAGESIZE 1000COLUMN username FORMAT A20COLUMN event FORMAT A30COLUMN wait_class FORMAT A15SELECT NVL(s.username, '(oracle)') AS username,s.sid,s.serial#,sw.event,--sw.wait_class,sw.wait_time,sw.seconds_in_wait,sw.stateFROM v$session_wait sw,v$session sWHERE s.sid = sw.sidand s.TYPE<>'BACKGROUND'--and s.SID ='11'---and sw.event!='SQL*Net message from client'---and s.sid in (select sid from v$px_session where qcsid ='1357')ORDER BY s.sid,sw.seconds_in_wait DESC;@which blockingselect l1.sid, ' IS BLOCKING ', l2.sid from v$lock l1, v$lock l2 where l1.block =1 and l2.request > 0 and l1.id1=l2.id1 and l1.id2=l2.id2; SET LINESIZE 500 SET PAGESIZE 1000 SET VERIFY OFF COLUMN owner FORMAT A20 COLUMN username FORMAT A20 COLUMN object_owner FORMAT A20 COLUMN object_name FORMAT A30 COLUMN locked_mode FORMAT A15 SELECT distinct b.session_id AS sid, NVL(b.oracle_username, '(oracle)') AS username, a.owner AS object_owner,a.object_name, Decode(b.locked_mode, 0, 'None', 1, 'Null (NULL)', 2, 'Row-S (SS)', 3, 'Row-X (SX)', 4, 'Share (S)', 5, 'S/Row-X (SSX)', 6, 'Exclusive (X)', b.locked_mode) locked_mode, b.os_user_name FROM dba_objects a, v$locked_object b WHERE a.object_id = b.object_idORDER BY 1, 2, 3, 4; set pages 4999 linesize 300col owner for a20col segment_name for a25col segment_type for a25select owner,segment_name,segment_type from dba_segments where segment_name ='PLAN_TABLE';SET PAGESIZE 100SET LINESIZE 200SET VERIFY OFFCOLUMN plan FORMAT A50COLUMN object_name FORMAT A30COLUMN object_type FORMAT A15COLUMN bytes FORMAT 9999999999COLUMN cost FORMAT 9999999COLUMN partition_start FORMAT A20COLUMN partition_stop FORMAT A20SELECT LPAD(' ', 2 * (level - 1)) ||DECODE (level,1,NULL,level-1 || '.' || pt.position || ' ') ||INITCAP(pt.operation) ||DECODE(pt.options,NULL,'',' (' || INITCAP(pt.options) || ')') plan,pt.object_name,pt.object_type,pt.bytes,pt.cost,pt.partition_start,pt.partition_stopFROM plan_table ptSTART WITH pt.id = 0AND pt.statement_id = '&1'CONNECT BY PRIOR pt.id = pt.parent_idAND pt.statement_id = '&1';=============================================================================================================================================---------------------------------------------------Session_Info-------------------------------------------------------set pages 300set lines 300col sid for 9999col serial# for 999999col USERNAME for a15col OSUSER for a10col LOGON_TIME for a20col PROGRAM for a27col MACHINE for a10col status for a20select sid,serial#,username,osuser,TO_CHAR(logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time,program,machine,status from v$session where sid in (651,1259);select sid,serial#,username,osuser,TO_CHAR(logon_Time,'DD-MON-YYYY HH24:MI:SS') AS logon_time,program,machine,status from v$session where sid in (1503,1642,1682);---------------------------------------------------Long_run_Info--------------------------------------------------------------COLUMN sid FORMAT 999,99999COLUMN serial# FORMAT 9999999COLUMN machine FORMAT A20COL USERNAME for a15COLUMN OPNAME FOR A20COLUMN progress_pct FORMAT 99999999.00COLUMN elapsed FORMAT A10COLUMN remaining FORMAT A20COLUMN REM_MIN FOR A10set linesize 300SELECT distinct s.username,s.sid,s.serial#,sl.opname,s.machine,sl.SOFAR,sl.TOTALWORK,TRUNC(sl.elapsed_seconds/60) || ':' || MOD(sl.elapsed_seconds,60) elapsed,TRUNC(sl.time_remaining/60) || ':' || MOD(sl.time_remaining,60) REM_MIN--ROUND(sl.sofar/sl.totalwork*100, 2) progress_pctFROM v$session s,v$session_longops slWHERE s.sid = sl.sidAND s.serial# = sl.serial#--and s.sid in ('403','432','291','190','462','56','507','476','1305')--AND s.sid in (select sid from v$px_session where qcsid ='1723')and sl.sofar<>sl.totalwork;SQL InfoSELECT distinct b.sid,b.username,a.SQL_TEXT,a.ROWS_PROCESSED--,a.SQL_ID FROM V$SQL a, v$session bWHERE a.address = b.sql_address AND a.hash_value = b.sql_hash_valueand b.sid ='386'---and b.sid in (select sid from v$px_session where qcsid='1081')---------------------------------------------------Locked_object_Info--------------------------------------------------------------SET LINESIZE 500SET PAGESIZE 1000SET VERIFY OFFCOLUMN owner FORMAT A20COLUMN username FORMAT A20COLUMN object_owner FORMAT A20COLUMN object_name FORMAT A30COLUMN locked_mode FORMAT A15SELECT b.session_id AS sid,NVL(b.oracle_username, '(oracle)') AS username,a.owner AS object_owner,a.object_name,Decode(b.locked_mode, 0, 'None',1, 'Null (NULL)',2, 'Row-S (SS)',3, 'Row-X (SX)',4, 'Share (S)',5, 'S/Row-X (SSX)',6, 'Exclusive (X)',b.locked_mode) locked_mode,b.os_user_nameFROM dba_objects a,v$locked_object bWHERE a.object_id = b.object_id and b.session_id=3047ORDER BY 1, 2, 3, 4;SET PAGESIZE 14SET VERIFY ON=================LOCKED OBJECTS=======================select c.owner,c.object_name,c.object_type,b.sid,b.serial#,b.status,b.osuser,b.machinefrom v$locked_objects a,v$session b,dba_objects cwhere b.sid=a.session_id and a.object_id=s.object_id==select sid,serial#,username from v$session where sid=140;alter system kill session 'sid,serial#';------------------------------------------I/O---------------------------------------------------------------------------if physicalgets changes then some select statement is running--if block_change and consistentgets changing then some update or delete statement is going on.col SID for 99999col BLOCK_GETS for 9999999999col CONSISTENT_GETS for 9999999999col PHYSICAL_READS for 9999999999col BLOCK_CHANGES for 9999999999col CONSISTENT_CHANGES for 9999999999select SID,BLOCK_GETS,CONSISTENT_GETS,PHYSICAL_READS,BLOCK_CHANGES,CONSISTENT_CHANGES from v$sess_io where sid in (514,492,487,466,458,611,533,627):;select * from v$sess_io where sid in (select sid from v$px_session where qcsid=1305);select SID,BLOCK_GETS,CONSISTENT_GETS,PHYSICAL_READS,BLOCK_CHANGES,CONSISTENT_CHANGES from v$sess_io where sid in (949);---------------------------SQL_TEXT_BASED_ON_SQL_ID------------------------------------------------------------------------------set pages 300set lines 300col sid for 9999col user_opening for 9999col users_executing for 9999col elapsed_time for 99999999999999col loads for 99999999col rows_processed 9999999col last_Active_time for a30set long 99999999999999select se.sid,s.SQL_FULLTEXT,s.USERS_OPENING,s.USERS_EXECUTING,s.ELAPSED_TIME,s.LOADS,ROWS_PROCESSED,to_char(s.LAST_ACTIVE_TIME,'DD:MM:YYYY HH24:MI:SS') LAST_ACTIVE_TIMEfrom v$sql s,v$session sewhere s.sql_id=se.sql_idand se.sid in ( );---------------Query to find out the session info including the SQL TEXT and the amount of time elapsed since the SID is running.-------------------set pages 10000col username form a20col machine form a30col osuser form a10col gets_per_exec form 99999999999select s.username,s.sid,s.serial#,s.osuser,p.spid,s.machine,sql_text,v$sqlarea.hash_value,to_char(logon_time, 'mm/dd/yyyy hh24:mi:ss') "LOGON TIME",to_char(trunc(last_call_et/3600,0))||' '||' HRS '||to_char(trunc((last_call_et - trunc(last_call_et/3600,0)*3600) /60,0))|| ' MINS' "Running Time"from v$sqlarea , v$session s,v$process pwhere s.sql_address = addressand s.status = 'ACTIVE'and s.paddr = p.addrand s.username is not nulland last_call_et > 60*&minutes and s.sid=625;-- Pass the minutes value as an input and 0 will display everythingorder by last_call_et/ ---------------Query to find out the SID from Process ID-------------------SET LINESIZE 500SET PAGESIZE 1000COLUMN username FORMAT A10COLUMN osuser FORMAT A10COLUMN SID for 99999COLUMN SERIAL# for 99999COLUMN SPID for 99999COLUMN lockwait FORMAT A18COLUMN status FORMAT A10COLUMN module FORMAT A15COLUMN machine FORMAT A15COLUMN program FORMAT A15select * from v$session,v$process where addr=paddr and process='13091';==========================================================================================================================================From process id-find SIDselect sid from v$sessionwhere paddr in (select addrfrom v$processwhere spid=&sp_id);From SID using v$px_session find qcsid(parent sid);select SID,SERIAL#,QCSID from v$px_session where SID=610;Using qcsid we can find all child process of qcsidSQL> select SID,SERIAL#,QCSID from v$px_session where qcsid=587; SID SERIAL# QCSID---------- ---------- ----------482 15737 587610 45962 587614 39150 587618 38354 587587 30314 587From SID-Find ProcessIDselect spid from v$processwhere addr in (select paddrfrom v$sessionwhere sid=&sid);==========================================================================================================================================***UNDO MONITORING****set linesize 450 pages 99999col sid_serial format a20col orauser format a20col program format a30col undoseg format a20col Undo format a20col undoseg format a10col undoseg format a20SELECT distinct TO_CHAR(s.sid)||','||TO_CHAR(s.serial#) sid_serial, NVL(s.username, 'None') orauser, s.program,r.name undoseg,t.used_ublk * TO_NUMBER(x.value)/1024||'K' "Undo(KB)"FROM sys.v_$rollname r, sys.v_$session s, sys.v_$transaction t,sys.v_$parameter xWHERE s.taddr = t.addrAND r.usn = t.xidusn(+)AND x.name = 'db_block_size';undoneeded:===========SELECTROUND(d.undo_size/(1024*1024),2) "ACTUAL UNDO SIZE [MByte]",SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]",ROUND((TO_NUMBER(e.value)*TO_NUMBER(f.value)*g.undo_block_per_sec)/(1024*1024),2) "NEEDED UNDO SIZE [MByte]"FROM(SELECTSUM(a.bytes) undo_sizeFROMv$datafile a,v$tablespace b,dba_tablespaces cWHEREc.contents = 'UNDO'AND c.status = 'ONLINE'AND b.name = c.tablespace_nameAND a.TS# = b.TS#) d,v$parameter e,v$parameter f,(SELECTMAX(undoblks/((end_time-begin_time)*3600*24))undo_block_per_secFROMv$undostat) gWHEREe.name = 'undo_retention'AND f.name = 'db_block_size';============undoretention(optimal):============SELECT d.undo_size/(1024*1024) "ACTUAL UNDO SIZE [MByte]",SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]",ROUND((d.undo_size / (to_number(f.value) *g.undo_block_per_sec))) "OPTIMAL UNDO RETENTION [Sec]"FROM (SELECT SUM(a.bytes) undo_sizeFROM v$datafile a,v$tablespace b,dba_tablespaces cWHERE c.contents = 'UNDO'AND c.status = 'ONLINE'AND b.name = c.tablespace_nameAND a.ts# = b.ts#) d,v$parameter e,v$parameter f,(SELECT MAX(undoblks/((end_time-begin_time)*3600*24))undo_block_per_secFROM v$undostat) gWHERE e.name = 'undo_retention'AND f.name = 'db_block_size'/=========================================================================================================================================***Roles/Privileges*******General***SELECT grantee "User",granted_role "Role",admin_option "Adm"FROM dba_role_privs aWHERE grantee='DM_COMMON';SELECT grantee "User",privilege "Privilege",admin_option "Adm"FROM dba_sys_privs where grantee='DM_COMMON';***User Specified***SET SERVEROUTPUT ONSET VERIFY OFFSELECT a.granted_role "Role",a.admin_option "Adm"FROM user_role_privs a;SELECT a.privilege "Privilege",a.admin_option "Adm"FROM user_sys_privs a;SET VERIFY ON==========================================================================================================================================-----------------------------High water mark in datafile -------------------------------------------set verify offcolumn file_name format a50 word_wrappedcolumn smallest format 999,990 heading "Smallest|Size|Poss."column currsize format 999,990 heading "Current|Size"column savings format 999,990 heading "Poss.|Savings"break on reportcompute sum of savings on reportcolumn value new_val blksizeselect value from v$parameter where name = 'db_block_size'/select file_name,ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) smallest,ceil( blocks*&&blksize/1024/1024) currsize,ceil( blocks*&&blksize/1024/1024) -ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) savingsfrom dba_data_files a,( select file_id, max(block_id+blocks-1) hwmfrom dba_extentsgroup by file_id ) bwhere a.file_id = b.file_id(+)and a.tablespace_name='&Tablespace_Name';######################################################################################################################currenttab:----------select table_name,round((blocks*8),2)||'kb' "size" from user_tables where table_name = 'BIG1';actualtab:---------select table_name,round((num_rows*avg_row_len/1024),2)||'kb' "size" from user_tables where table_name = 'BIG1';==========================================================================================================================================---------------------------------------------dba_directories-------------------------------------------set lines 100set linesize 500col owner for a10col DIRECTORY_NAME for a20col DIRECTORY_PATH for a70select * from dba_directories;==========================================================================================================================================---------------------------------------------reorg_checks-------------------------------------------cl scrset verify off feed offundef 1column SEGMENT_NAME format a25column tablespace_name format a20set line 200set pages 1000select a.segment_name,c.tablespace_name,a.bytes/1024/1024,a.extents,b.last_analyzedfrom dba_segments a,dba_tables b,dba_tablespaces cwhere a.segment_name = '&&1'and a.segment_name = b.table_name and a.tablespace_name = c.tablespace_name;set pages 0select a.segment_name,c.tablespace_name,a.bytes/1024/1024,a.extents,b.last_analyzedfrom dba_segments a,dba_indexes b,dba_tablespaces cwhere a.segment_name in(select index_name from dba_indexeswhere table_name = '&&1')and a.segment_name = b.index_name and a.tablespace_name = c.tablespace_nameorder by a.segment_name;set pages 0set echo offcol DATA_TYPE for a15select DATA_TYPE ||' Type YES' from dba_Tab_columns where table_name='&&1'and data_type like ('%RAW');==========================================================================================================================================----------------Most fragmented tables---------------select table_name,round((blocks*8),2) "size (kb)" , round((num_rows*avg_row_len/1024),2) "actual_data (kb)",(round((blocks*8),2) - round((num_rows*avg_row_len/1024),2)) "wasted_space (kb)"from dba_tableswhere (round((blocks*8),2) > round((num_rows*avg_row_len/1024),2))order by 4 desc===========================================================================================================================================-----------------Long running queries---------------SELECT s.SID,s.serial#,s.machine,ROUND(sl.elapsed_seconds/60) || ':' ||MOD(sl.elapsed_seconds,60) elapsed,ROUND(sl.time_remaining/60) || ':' ||MOD(sl.time_remaining,60) remaining,ROUND(sl.sofar/sl.totalwork*100, 2) progress_pctFROM v$session s,v$session_longops slWHERE s.SID = sl.SIDAND s.serial# = sl.serial#ORDER BY 4 DESCAnd then run the following query SELECT a.sql_textFROM v$sqltext a,v$session bWHERE a.address = b.sql_addressAND a.hash_value = b.sql_hash_valueAND b.sid = &1 --> From above sqlORDER BY a.piece;BASH_PROFILE:============export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATHPATH=$PXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>TRUE);SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>FALSE);================@metatbs:-------declare c clob;beginfor t in( select tablespace_name from dba_tablespaces)loopselect dbms_metadata.get_ddl('TABLESPACE', t.tablespace_name) into c from dual;dbms_output.put_line(c);dbms_output.put(';');end loop;end;=========================https://www.scribd.com/doc/187559341/How-to-Change-Dbname-Dbid-and-Instance-Name=======IMP===ASM========https://www.youtube.com/watch?v=ll_orkRC3ro =================== TRASPORTABLE TABLESPACE============@transportable tbshttp://dba-expert.blogspot.in/2012/02/cross-platform-migration-using-rman.htmlSQL> COLUMN PLATFORM_NAME FORMAT A36SQL> SELECT * FROM V$TRANSPORTABLE_PLATFORM ORDER BY PLATFORM_NAME;SQL> select * from v$transportable_platform order by 3,1;#######################################################################################################################################cms:----create table ACC_ER_UR_PREMIUM_HIST as select * from ACC_ER_UR_PREMIUM where 1=2;create table ACC_ER_UR_PREMIUM_TEMP as select * from ACC_ER_UR_PREMIUM where 1=2;/insert /*+ APPEND */ FIRSTWHEN DAT_CALCULATION_DATE <= to_date('31/03/2014','dd/mm/yyyy')THEN INTO ACC_ER_UR_PREMIUM_HISTELSE INTO ACC_ER_UR_PREMIUM_TEMPSELECT /*+ FULL */ * from ACC_ER_UR_PREMIUM;JOB_SCHEDULE_DTLS to check batchjobselect * from dba_scheduler_running_jobs;select * from gv$session_longops where time_remaining>1;select count(1) from v$session where status='ACTIVE' and username is not null ;select sql_id,value_string from DBA_HIST_SQLBIND where sql_id = '98kn006gbj438'select * from table(dbms_xplan.display_awr('6gurz7cb0jgbt'));select userid,acfunc_decoder(upassword) from cnfgtr_user_mstr where UPPER(userid) like 'APPSUP%';https://www.rediffmail.com/cgi-bin/login.cgi1)cd /home/ias/IasHome/opmn/bin2)./opmnctl startproc process-type=cmsor3)./opmnctl startproc ias-component=dcm-daemon//////////////////////////////////////////////////////////////////////////--Execute the procedure with payment id & cheque date.DECLARE L_NUM_INSTRUMENT_ID NUMBER;L_CHANGED_TO_DATE DATE;BEGIN L_NUM_INSTRUMENT_ID := 1001052070;L_CHANGED_TO_DATE := to_date('','dd/mm/rrrr'); INS.ACC_CHQ_DATE_CHANGE ( L_NUM_INSTRUMENT_ID, L_CHANGED_TO_DATE );COMMIT; END; /--After execution please run the below select query to verify the modification of cheque date. --------------------------------------------------------------------------/SELECT num_instrument_id, dat_instrument_date original_chq_date,dat_changed_to_date changed_chq_date, txt_proc_run,num_r_u_ape "Rows in Payment_entry", num_r_u_acd "Rows in Collection",num_r_u_agl "Rows in Ledger", dat_log_date "RUN DATE"FROM chq_date_change_logWHERE num_instrument_id = 1000945370;/appsupport@universalsompo.comC789fHLTabsalkar@in.ibm.comasif.ahmed@in.ibm.comcustomer.first@indiafirstlife.comSELECT username U_NAME, owner OBJ_OWNER,object_name, object_type, s.osuser,DECODE(l.block,0, 'Not Blocking',1, 'Blocking',2, 'Global') STATUS,DECODE(v.locked_mode,0, 'None',1, 'Null',2, 'Row-S (SS)',3, 'Row-X (SX)',4, 'Share',5, 'S/Row-X (SSX)',6, 'Exclusive', TO_CHAR(lmode)) MODE_HELDFROM gv$locked_object v, dba_objects d,gv$lock l, gv$session sWHERE v.object_id = d.object_idAND (v.object_id = l.id1)AND v.session_id = s.sidORDER BY username, session_id;//////////////////////// blocked sessions//////////////////////////////Select blocking_session, sid, serial#, wait_class,seconds_in_wait From v$session where blocking_session is not NULLorder by blocking_session;SELECT BLOCKSFROM DBA_SEGMENTSWHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);ANALYZE TABLE owner.table ESTIMATE STATISTICS;SELECT EMPTY_BLOCKSFROM DBA_TABLESWHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);select a.sid,a.program,b.sql_text from v$session a, v$sqltext b where a.sql_hash_value = b.hash_value--and a.sid=485 order by a.sid,hash_value,piece;Select wait_class, sum(time_waited), sum(time_waited)/sum(total_waits) Sum_Waits From v$system_wait_classGroup by wait_classOrder by 3 Asc;select a.sid, a.event, a.total_waits, a.time_waited, a.average_wait from v$session_event a, v$session b where time_waited > 0and a.sid=b.sid and b.username is not NULL and a.event='enq: TX - row lock contention';Select blocking_session, sid, serial#, wait_class, seconds_in_wait From v$session where blocking_session is not NULLorder by blocking_session;select sid, serial#, username, osuser, machine from v$session where username is not NULL;SELECT wait_class,NAME,ROUND (time_secs, 2) time_secs,ROUND (time_secs * 100 / SUM (time_secs) OVER (), 2) pct FROM (SELECT n.wait_class,e.event NAME,e.time_waited / 100 time_secs FROM v$system_event e, v$event_name n WHERE n.NAME = e.event AND n.wait_class <> 'Idle' AND time_waited > 0 UNION SELECT 'CPU', 'server CPU',SUM (VALUE / 1000000) time_secs FROM v$sys_time_model WHERE stat_name IN ('background cpu time', 'DB CPU')) ORDER BY time_secs DESC;grep -H -r "srvconfig" /home/ias/ ////////////// LOCKED OBJECTS /////////////////////////////select count(*) cnt, session_id sid,substr(event,1,30) event, mod(p1,16) as lm,sql_id,CURRENT_OBJ# || ' ' || object_name obj, o.object_type type, CURRENT_FILE# file#, CURRENT_BLOCK# block#, blocking_session bsidfrom dba_hist_active_sess_history ash,all_objects owhereevent like 'enq: T%'and o.object_id (+)= ash.current_obj#and ash.snap_id between 44559 and 44560group by event,session_id,p1,sql_ID,CURRENT_OBJ#,OBJECT_NAME,OBJECT_TYPE,CURRENT_FILE#, CURRENT_BLOCK#, BLOCKING_SESSIONorder by count(*) desc/u01/app/oracle/admin/configdb/bdump prod DB/testdb/configdb/admin/udump //configdv/testdb/configdev/dump/udump //dev/oradata6/uattest/admin/udump // uattestUltimatix.Helpdesk@cmcltd.com ///////// after opmn/bin/......................////////////////////bin]$./opmnctl start ias-component=performance_serverfor uattest-refresh: cd /orasan2/uattest_refresh/expdumpPOLICY_DOC_MNGMT_DTL/home/ias/IasHome/Apache/Apache/logs/httpd.pid/home/ias/IasHome/Apache/Apache/confhttp://172.16.8.19:1811/emd/console/ias/clusters/farm$farm=IasHome.reportserver.sompohttp://172.16.4.11:1810/emd/console/ias/clusters/farm$farm=IasHome.srvconfigrp1proposal num 2311108805842SELECT l.session_id||','||v.serial# sid_serial,l.ORACLE_USERNAME ora_user,o.object_name, o.object_type, DECODE(l.locked_mode, 0, 'None',1, 'Null',2, 'Row-S (SS)',3, 'Row-X (SX)',4, 'Share',5, 'S/Row-X (SSX)',6, 'Exclusive', TO_CHAR(l.locked_mode)) lock_mode,o.status, to_char(o.last_ddl_time,'dd.mm.yy') last_ddlFROM dba_objects o, gv$locked_object l, v$session vWHERE o.object_id = l.object_idand l.SESSION_ID=v.sid--AND object_name in ('CLAIM_GENERAL_DETAILS') order by 2,3;appsupport@universalsompo.comC789fHLT User ID - APPSUP03Password - YU7808N37O User ID - APPSUP04Password - UH8059R73X\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\select a.session_id,a.oracle_username, a.os_user_name, b.owner "OBJECT OWNER", b.object_name,b.object_type,a.locked_mode from (select object_id, SESSION_ID, ORACLE_USERNAME, OS_USER_NAME, LOCKED_MODE from v$locked_object) a, (select object_id, owner, object_name,object_type from dba_objects) bwhere a.object_id=b.object_idselect *from CLAIM_TPA_LOGwhere TXT_XML_ID in (select TXT_XML_IDfrom CLAIM_TPA_LOGwhere DAT_INSERT_DATE = to_date('12/02/2013','dd/mm/yyyy') --Change Date hereand NUM_TPA_CLAIM_NO = 'USGI016153' -- change tpa claim number hereAND TXT_XML_TYPE = 'INTIMATION') --Change typeselect object_name,object_type from dba_objects where owner = '&user'order by object_type, object_name////////////////////////////////////////////////////select * from user_objects where OBJECT_TYPE = 'PACKAGE' and OBJECT_NAME like '%HLTH_PROCESSING%'select * from v$archive_gap;for DR: cd /rmanbackup/archivefor prod: cd /archiveselect username, count(*) from V$SESSION group by username ;select username,osuser,terminal, from v$session where username is not null order by username,osuser;select * from v$session where program='w3wp.exe'select * from v$session where program='w3wp.exe' and OSUSER='IUSR_SRVCONFIGAS2';select * from (selectash.SQL_ID ,sum(decode(ash.session_state,'ON CPU',1,0)) "CPU",sum(decode(ash.session_state,'WAITING',1,0)) "All_Waits",sum(decode(ash.session_state,'WAITING', decode(wait_class, 'Cluster',1,0),0)) "Cluster" ,sum(decode(ash.session_state,'WAITING', decode(wait_class, 'User I/O',1,0),0)) "User_I/O" ,sum(decode(ash.session_state,'ON CPU',1,1)) "TOTAL"from dba_hist_active_sess_history ashwhere SQL_ID is not NULLand snap_id between 25814 and 25816 group by sql_idorder by sum(decode(session_state,'ON CPU',1,1)) desc)where rownum <=5alter system kill session '105,23597'; {{ CMS PEOPLE )SELECT txt_user_id, cms.cms_decode_str (txt_password, TO_DATE (dat_creation_date, 'dd/mm/yyyy')) FROM cms.cms_user_mstselect * from table(dbms_xplan.display_cursor('6gurz7cb0jgbt'));select userid,acfunc_decoder(upassword) from cnfgtr_user_mstr where UPPER(userid) like 'PRAGOP%'; (((( PSW INF for cmsSELECT CNFGTR_DECODER('pK< //qq ') FROM CNFGTR_USER_MSTR WHERE USERID = 'CONCON80'; ))SQL> create index indb_transaction_id_old on cnfgtr_tran_stat_hist(transaction_id_old) tablespace indx nologging;Index created.TKPROFgo to bdump or udump or adump$tkprof filename.trc filename.txt sys=no sort=fchelatkprof mydb_ora_29951_ORDERS_QUERY.trc ORDERS_QUERY.tkp waits=yessys=no sort=fchela,exeela,prselaexplain plan for select * from emp:SQL> select * from table(dbms_xplan.display);////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\///////////////////Trace the file.....................................................set heading onset timing onalter session set tracefile_identifier = 'SUMAN_21092012';alter session set events '10046 trace name context forever,level 8';execute script (select statment)//////////////////////////////////////////////////////////////////////////////////////////select to_date(LOGON_TIME,'dd/mm/yyyy') LOGON_TIME,status,TYPE,STATE,count(*) from v$sessiongroup by to_date(LOGON_TIME,'dd/mm/yyyy'),status,TYPE,STATEorder by 1,2Select -- s.username, s.LOGON_TIME, 'alter system kill session '''||s.sid||','||s.serial#||''';' "Kill Statement"FROM V$SESSION s , V$PROCESS pWHERE s.paddr = p.addrAND s.username IS NOT NULLAND s.username = 'INS'AND s.last_call_et > 900and s.status='INACTIVE';rem session.sql - displays all connected sessionsset echo off;set termout on;set linesize 80;set pagesize 60;set newpage 0;/////\\\\\\\\\\\\\\\/////////////////\\\\\\\\\\\\\\\////////////////\\\\\\\\\\\\\select rpad(c.name||':',11)||rpad(' current logons='|| (to_number(b.sessions_current)),20)||'cumulative logons='||rpad(substr(a.value,1,10),10)||'highwater mark='||b.sessions_highwater Informationfromv$sysstat a,v$license b,v$database cwherea.name = 'logons cumulative';////////////////////////////////////////////////////////////////////////////////////////////////////////////////select a.USERNAME,substr(a.spid,1,9) pid, substr(b.sid,1,5) sid,substr(b.serial#,1,5) ser#,substr(b.machine,1,6) box,substr(b.username,1,10) username,substr(b.osuser,1,8) os_user,substr(b.program,1,30) program from v$session b,v$process awhere b.paddr = a.addr and type='USER'AND a.USERNAME IS NOT NULL order by spid;ttitle off;set heading off;select 'To kill, enter SQLPLUS> ALTER SYSTEM KILL SESSION',''''||'SID, SER#'||''''||';' from dual;////////////////////////////////////////////////////////////////////////////////////////////////////////////////select‘alter system kill session ‘’’|| sess.sid||’, ‘||sess.serial#||’;’from v$locked_object lo, dba_objects ao, v$session sess where ao.object_id = lo.object_idand lo.session_id = sess.sid;select count(*) from v$session where status='INACTIVE' and username is not null ;select username,osuser,terminal from v$session where username is not null order by username,osuser;select * from v$session where program='w3wp.exe';select * from v$session where program='w3wp.exe' and OSUSER='IUSR_SRVCONFIGAS2';select * from v$session where status='ACTIVE' and username is not null ;select count(1) from v$session where username is not null ;select count(*) from v$session where status='ACTIVE' and username is not null ;///////////////////////////////CMC LimitedC-18, Bandra Kurla ComplexBandra (E), Mumbai - 400051Mobile: +91 9619992270Direct Line: +91 22 67811780BEGINSYS.DBMS_SCHEDULER.CREATE_JOB(job_name => 'PSP_GANESH_01',start_date => TO_TIMESTAMP_TZ('2009/09/02 15:30:00.000000 +05:30','yyyy/mm/dd hh24:mi:ss.ff tzh:tzm'),repeat_interval => 'freq=daily;byhour=00;byminute=30;',end_date => NULL,job_class => 'DEFAULT_JOB_CLASS',job_type => 'PLSQL_BLOCK',job_action => 'declare I_RUN_DATE DATE;BEGIN I_RUN_DATE := to_date(sysdate,''dd/mm/rrrr'')-1; PSP.PROC_FETCH_POLICY_DATA_g1 ( I_RUN_DATE );COMMIT; end;',comments => 'Job scheduler for ganesh Request');END;/NUM_POL_PREMIUM -- Policy DataTXT_OCC_SRL_NO_OCCUPANCY -- occupancy data filter by code 1NUM_OCC_PREMIUM -- replace with NUM_POL_PREMIUM -- Policy DataTXT_OCC_SRL_NUMBER_OCCUPANCY -- PerilsNUM_COVER_PERIL_PREMIUM - replace with NUM_POL_PREMIUM -- Policy Data9830866750 surajit mallikemd_web_site.xml AGENT_HOME/bin/emctl start agent$ORACLE_HOME/bin/emctl start iasconsoleemctl resetTZ agentemctl istop agentemctl stop oms/////////////////////////////////// Bulk patch log Script//////////////////////////select *fromconfsys.CNFGTR_PATCH_LOGwhereto_date(RUN_DATE,'dd/mm/yyyy') = to_date('15/07/2013','dd/mm/yyyy')General Manager (Personnel), The Singareni Collieries Co. Ltd., RecruitmentCell, Kothagudem 507 101, Khammam Dist. (AP) only by POST / COURIER toreach on or before 19/08/2013, super scribing the application registrationACC_PAYMENT_ENTRYACC_MAP_INSTRPROPOSALCHQ_DATE_CHANGE_LOGACC_RTGS_REVERSE_FILEZ:\Mumbai\CommonShare\Daily_Reports\Accounts\DailyPaymentDetails\FY-2012\SEP 2013X:\CommonShare\Claims_Report\Claim Intimation Register\SEP 2013X:\CommonShare\Claims_Report\Claim_Mis_New\SEP 2013Z:\Mumbai\CommonShare\Daily_Report\Cash_collection_BRS\SEP 2013X:\CommonShare\Claims_Report\F&A Claim Paid & OS\SEP 2013policy loading issue1.take reference no.2.check in CNFGTR_POLICY_LD_DTLS table.3.check LD_CALC_AMT field in above table.4. if two record found then delete one record having LD_CALC_AMT value = 0.5. Commit.C:\WINDOWS\system32\inetsrvdel_execute.batdel_pdf_execute.batexecute.batmerge_execute.batLocation of JSPs: ./resources/jsp/reinsuranceLocation of XML: ./WEB-INF/reinsuranceLocation of JAVA and CLASSes: ./WEB-INF/classes/geni/reinsuranceswapneel 9819615585Mahesh D MahadikHuman Resources - WRCMC LimitedC-18, Bandra Kurla ComplexBandra (E), Mumbai - 400051Mobile: +91 9967919798Direct Line: +91 22 67811779Website: www.cmcltd.comhttp://tata.mymeetingroom.comuser id: 5077321pass: u220t0http://docs.oracle.com/cd/E23104_01/download_readme_cr2/download_readme_cr2.htmIn this URL please selectTask 3: Select an Oracle Forms and Reports Software Download Site thendownload the installer for RHEL 5 linux 64-bit version.Note: file name may be like ofm_pfrd_linux_11.1.1.2.0_32_disk1_1of1.zip inhttp://edelivery.oracle.com/http://www.oracle.com/technetwork/developer-tools/forms/downloads/index.html////////////////////////////////////////CLAIM_MOTO_SCHEDULERif u not got record then go for genisyssSelect record for claim number.Create insert statementupdate insert key from 1 to 0upate update no from 1 to 0execute the insert statement.JOB_SCHEDULE_DTLS to check batchjob////////////////////////////////////////////////////Patch urlhttps://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=964676135662004&id=1618213.1&_afrWindowMode=0&_adf.ctrl-state=bjnr004kr_4#BABBCHHD30 0 * * * root find /tmp -type f -empty -delete####################################################################################################################################################################################################################]lmk:shrinkdatafile:--------------set linesize 1000 pagesize 0 feedback off trimspool onwithhwm as (-- get highest block id from each datafiles ( from x$ktfbue as we don't need all joins from dba_extents )select /*+ materialize */ ktfbuesegtsn ts#,ktfbuefno relative_fno,max(ktfbuebno+ktfbueblks-1) hwm_blocksfrom sys.x$ktfbue group by ktfbuefno,ktfbuesegtsn),hwmts as (-- join ts# with tablespace_nameselect name tablespace_name,relative_fno,hwm_blocksfrom hwm join v$tablespace using(ts#)),hwmdf as (-- join with datafiles, put 5M minimum for datafiles with no extentsselect file_name,nvl(hwm_blocks*(bytes/blocks),5*1024*1024) hwm_bytes,bytes,autoextensible,maxbytesfrom hwmts right join dba_data_files using(tablespace_name,relative_fno))selectcase when autoextensible='YES' and maxbytes>=bytesthen -- we generate resize statements only if autoextensible can grow back to current size'/* reclaim '||to_char(ceil((bytes-hwm_bytes)/1024/1024),999999)||'M from '||to_char(ceil(bytes/1024/1024),999999)||'M */ '||'alter database datafile '''||file_name||''' resize '||ceil(hwm_bytes/1024/1024)||'M;'else -- generate only a comment when autoextensible is off'/* reclaim '||to_char(ceil((bytes-hwm_bytes)/1024/1024),999999)||'M from '||to_char(ceil(bytes/1024/1024),999999)||'M after setting autoextensible maxsize higher than current size for file '|| file_name||' */'end SQLfrom hwmdfwherebytes-hwm_bytes>1024*1024 -- resize only if at least 1MB can be reclaimedorder by bytes-hwm_bytes desc/burleson shir:------------select 'alter database '||a.name||' datafile '''||b.file_name||'''' ||' resize '||(bytes_total-bytes_free)from v$database a,dba_data_files b,(Select tablespace_name,sum(bytes) bytes_fullFrom dba_extentsGroup by tablespace_name) c,(Select tablespace_name,sum(bytes) bytes_totalFrom dba_data_filesGroup by tablespace_name) d,(Select a.tablespace_name,a.file_id,b.bytes bytes_freeFrom (select tablespace_name,file_id,max(block_id) max_data_block_id from dba_extentsgroup by tablespace_name,file_id) a,dba_free_space bwhere a.tablespace_name = b.tablespace_nameand a.file_id = b.file_idand b.block_id > a.max_data_block_id) eWhere b.tablespace_name = c.tablespace_nameAnd b.tablespace_name = d.tablespace_name;##################################################################################################################################################################################################mostoftensql:-------------SELECTsql_text,executionsFROM(SELECTsql_text,executions,rank() over ( order by executions DESC) exec_rankFROMv$sql)WHEREexec_rank >10;/################################mostiosql:----------SELECTdisk_reads,sql_textFROM(SELECTsql_text,disk_reads,dense_rank() over ( order by disk_reads DESC) disk_reads_rankFROMv$sql)WHEREdisk_reads <=10;##################################################mostlogcalsql:-------------SELECTbuffer_gets,sql_textFROM(SELECTsql_text,buffer_gets,dense_rank() over (order by buffer_gets DESC) buffer_gets_rankFROMv$sql)WHEREbuffer_gets <=10;#########################################################################################Find the SQL for the expensive queryHere the expensive means either physical io or logical io large than 10000, the number could be differ depends on the environment.Get the hash code firstselect hash_value,executions, buffer_gets,disk_reads, parse_callsfrom v$SQLAREAwhere buffer_gets > 10000 or disk_reads > 10000orderby buffer_gets + 100 * disk_reads descGet the SQLselect address,hash_value,piece,sql_textfrom V$sqltextwhere hash_value = '487379649'orderby piece;Find the query planselectoperation,options, object_name, cost from v$sql_planwhere address = '58861A18'and hash_value='487379649'Find the query plan for the current active user sessionFind the active sessionselect username,terminal,program,sql_hash_value,sql_address,typefrom v$sessionwhere type notlike'BACKGROUND'select operation,options, object_name, cost from v$sql_planwhere address = '5F9F10F8'and hash_value='3509024188'#################################################################################################@unnamedg:---------Check for the files needs to be recovered.SQL> select * from v$recover_file where error like ‘%FILE%’;FILE# ONLINE ONLINE_ ERROR CHANGE# TIME—— ——- ——- ——————– ———- ——————–33 ONLINE ONLINE FILE MISSING 0SQL>Identify on primary of data file 33(Primary Database)SQL> select file#,name from v$datafile where file#=33;FILE# NAME—— ———————————————————————-33 M:\UNDO\UNDOTBS02.DBFSQL>Identify dummy file name created in (Standby)SQL> select file#,name from v$datafile where file#=33;FILE# NAME—— ———————————————————————-33 E:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00033SQL>Crosscheck that no MRP is running and STANDBY_FILE_MANAGEMENT can be enabled once after creating file on standbySQL> alter database create datafile ‘E:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00033’ as ‘M:\UNDO\UNDOTBS02.DBF;Database altered.SQL>If you are managing File system ASM with OMF, you are not allowed to create data file, because it will file system names and format maintained by ASM. If you try to create datafile as above with ASM File, You will pass with below error.SQL> alter database create datafile ‘ E:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE \UNNAMED00033’ as ‘+DATA3\UNDO\UNDOTBS02.DBF*ERROR at line 1:ORA-01276: Cannot add file+DATA3\UNDO\UNDOTBS02. File has an Oracle Managed Files file name.Then Run above command as shown belowSQL> alter database create datafile ‘E:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\UNNAMED00033’ as new;Database altered.SQL>Enable STANDBY_FILE_MANAGEMENT to AUTO & Start MRP.SQL> show parameter standby_file_managementNAME TYPE VALUE———————————— ———– ————————-standby_file_management string MANUALSQL> alter system set standby_file_management=AUTO scope=both;system altered.SQL> show parameter standby_file_managementNAME TYPE VALUE———————————— ———– ————————–standby_file_management string AUTOSQL> alter database recover managed standby database disconnect from session;Database altered.################################################################################################################################# @manualsync:---------increamental sync================1. [Standby] Stop the managed standby apply process:SQL> alter database recover managed standby database cancel;Database altered.2. [Standby] Shutdown the standby database3. [Primary] On the primary, take an incremental backup from the SCN number where the standby has been stuck:run { allocate channel c1 type disk format '/u01/rman_backup/inctl_%U.bkp'; backup incremental from scn 67 database;}using target database control file instead of recovery catalogallocated channel: c1channel c1: sid=139 devtype=DISKStarting backup at 18-DEC-09channel c1: starting full datafile backupsetchannel c1: specifying datafile(s) in backupsetinput datafile fno=00001 name=/u01/oradata/DEL1/datafile/o1_mf_system_5bhbh59c_.dbf… …piece handle=/u01/oraback/06l16u1q_1_1.rmb tag=TAG20091218T083619 comment=NONEchannel c1: backup set complete, elapsed time: 00:00:06Finished backup at 18-DEC-09released channel: c14. [Primary] On the primary, create a new standby controlfile:SQL> alter database create standby controlfile as '/u01/rman_backup/inctl_%U.ctl';Database altered.5. [Primary] Copy these files to standby host:oracle@oradba1 /u01/oraback# scp *.rmb *.ctl oracle@oradba2:/u01/orabackoracle@oradba2's password:06l16u1q_1_1.rmb 100% 43MB 10.7MB/s 00:04 DEL1_standby.ctl 100% 43MB 10.7MB/s 00:04 6. [Standby] Bring up the instance in nomount mode:SQL> startup nomount7. [Standby] Check the location of the controlfile:SQL> show parameter control_filesNAME TYPE VALUE------------------------------------ ----------- ------------------------------control_files string /u01/oradata/standby_cntfile.ctl8. [Standby] Replace the controlfile with the one you just created in primary.9. $ cp /u01/oraback/DEL1_standby.ctl /u01/oradata/standby_cntfile.ctl10.[Standby] Mount the standby database:SQL> alter database mount standby database;11.[Standby] RMAN does not know about these files yet; so you must let it know – by a process called cataloging. Catalog these files:$ rman target=/Recovery Manager: Release 10.2.0.4.0 - Production on Fri Dec 18 06:44:25 2009Copyright (c) 1982, 2007, Oracle. All rights reserved.connected to target database: DEL1 (DBID=846390698, not open)RMAN> catalog start with '/u01/oraback';using target database control file instead of recovery catalogsearching for all files that match the pattern /u01/orabackList of Files Unknown to the Database=====================================File Name: /u01/oraback/DEL1_standby.ctlFile Name: /u01/oraback/06l16u1q_1_1.rmbDo you really want to catalog the above files (enter YES or NO)? yescataloging files...cataloging doneList of Cataloged Files=======================File Name: /u01/oraback/DEL1_standby.ctlFile Name: /u01/oraback/06l16u1q_1_1.rmb12.Recover these files:RMAN> recover database;######################################################################################################################3@gridconf:---------groupadd -g 1000 oinstallgroupadd -g 1020 asmadmingroupadd -g 1021 asmdbagroupadd -g 1031 dbagroupadd -g 1022 asmopergroupadd -g 1023 operuseradd -u 1100 -g oinstall -G asmadmin,asmdba,dba,asmoper griduseradd -u 1101 -g oinstall -G dba,asmdba,oper oraclepasswd oraclepasswd gridmkdir -p /u01/app/gridmkdir -p /u01/app/oraInventorymkdir -p /u01/app/11.2.0/gridmkdir -p /u01/app/oraclechown -R grid:oinstall /u01/app/11.2.0/gridchown -R grid:oinstall /u01/app/gridchown -R oracle:oinstall /u01/app/oraclechown -R grid:oinstall /u01/app/oraInventorychmod -R 775 /u01/app/oraInventorychmod -R 775 /u01/app/gridfdisk /dev/sdbecho "- - -" > /sys/class/scsi_host/host0/scan/etc/init.d/oracleasm createdisk VOL1 /dev/sdb1/etc/init.d/oracleasm createdisk VOL2 /dev/sdc1/etc/init.d/oracleasm createdisk VOL3 /dev/sdd1chown grid:asmadmin /dev/sdb1chmod 660 /dev/sdb1chown grid:asmadmin /dev/sdc1chmod 660 /dev/sdc1chown grid:asmadmin /dev/sdd1chmod 660 /dev/sdd1#################################################################################/sbin/ifconfignetstat -l#################################################################################librarycacheinfo:-----------------SELECT NAMESPACE, GETS, PINS, GETHITRATIO FROM V$LIBRARYCACHE;SELECT S.NAME, V.VALUE FROM V$STATNAME S, V$MYSTAT V WHERE S.STATISTIC# = V.STATISTIC# AND S.NAME LIKE 'parse%';########################################################################################@whentorebuild:--------------If the index has height greater than four, rebuild the indexThe deleted leaf rows should be less than 20%.SELECT name, height, lf_rows, del_lf_rows, (del_lf_rows/lf_rows)*100 as ratio FROM INDEX_STATS;ANALYZE INDEX <IDX_GAM_FID> VALIDATE STRUCTURE;ALTER INDEX <> REBULD REBUILD ONLINE;###################################################################################################sqltuningadvisor:-----------------CONNECT / AS SYSDBAGRANT ADVISOR TO SH;1.CONNECT sh@TESTDB/sh2.Define an SQL Tuning Task for a single query:DECLAREl_task VARCHAR2(30);l_sql CLOB;BEGINl_sql := 'SELECT AMOUNT_SOLD FROM sh.SALES S ' ||'WHERE S.CUST_ID IN ( '||'SELECT C.CUST_ID FROM sh.CUSTOMERS C ' ||'WHERE C.CUST_CREDIT_LIMIT IN (:l1, :l2, :l3))';l_task := DBMS_SQLTUNE.CREATE_TUNING_TASK(sql_text => l_sql,bind_list => sql_binds(anydata.ConvertNumber(10000),anydata.ConvertNumber(11000),anydata.ConvertNumber(15000)),user_name => 'SH',scope => 'COMPREHENSIVE',time_limit => 120,task_name => 'test_tuning_task',description => 'Specific SQL tuning');END;/3. Execute the SQL Tuning Task just defined:BEGINDBMS_SQLTUNE.EXECUTE_TUNING_TASK(task_name => 'test_tuning_task');END;/4. View the results of the tuning process:SET LINESIZE 120SET LONG 1000SET LONGCHUNKSIZE 1000SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK('test_tuning_task')FROM DUAL;5. Drop the SQL Tuning Task and revoke grants from user SH:EXEC DBMS_SQLTUNE.DROP_TUNING_TASK('test_tuning_task');CONNECT / AS SYSDBAREVOKE ADVISOR FROM SH;################################################################################################################################3@cachetable:----------ALTER TABLE SH.CUSTOMERS STORAGE (BUFFER_POOL KEEP);@objinbuffer:------------COL OBJECT_NAME FOR A30COL OBJECT_TYPE FOR A20SELECT OBJECT_NAME, OBJECT_TYPE, COUNT(*) AS "buffers"FROM SYS.X$BH XBH, SYS.DBA_OBJECTS OBJWHERE XBH.OBJ = OBJ.OBJECT_IDAND OWNER = 'SH'GROUP BY OBJECT_TYPE, OBJECT_NAMEORDER BY OBJECT_TYPE, OBJECT_NAME;v$db_object_cache:select owner,name,type,sharable_mem from v$db_object_cache where kept='YES';#############################################################################################################################bufferbusyavoid:---------------User ActionLook at v$waitstat (or the buffer busy drill down page) and determine the block type with the highest waits.Block Type and Action:Undo Header - Use Automatic Undo Management (AUM) or add more RBS segments)Undo Block - Use AUM (or increase RBS sizes)Data Block - First determine if it is an I/O problem. The Buffer Busy Waits drill-down page should provide this information. Otherwise, sample from v$session_waitSELECT p3, count(*) FROM v$session_wait WHERE event='buffer busy wait' group by p3;If p3 is less than 200 then it is an I/O problem. Either improve I/O performance or change application. Applications running concurrent batch jobs that do full table scans on the same large tables run into this problem.Free List - Use ASSM (or freelists groups)http://www.oracledba.in/Articles/display_article.aspx?article_id=53http://www.dba-oracle.com/art_builder_bbw.htm#################################################################indpartition:-------------select index_name from dba_indexes where table_name='MTC_MSG_TXT_CBS';select INDEX_OWNER,INDEX_NAME,PARTITION_NAME,STATUS,TABLESPACE_NAME from dba_ind_partitions where INDEX_NAME='MTC_MSG_TXT_CBS_IDX';sys@RTGSSFMS2> select INDEX_OWNER,INDEX_NAME,PARTITION_NAME,STATUS,TABLESPACE_NAME from dba_ind_partitions where INDEX_NAME='MTC_MSG_TXT_CBS_IDX';INDEX_OWNER INDEX_NAME PARTITION_NAME STATUS TABLESPACE_NAME------------------------------ ------------------------------ ------------------------------ -------- ------------------------------SFMSBR MTC_MSG_TXT_CBS_IDX P1 USABLE SFMS_BR_NDXSFMSBR MTC_MSG_TXT_CBS_IDX P2 USABLE SFMS_BR_NDXSFMSBR MTC_MSG_TXT_CBS_IDX P3 USABLE SFMS_BR_NDXalter index SFMSBR.MTC_MSG_TXT_CBS_IDX rebuild partition p1 online; alter index SFMSBR.MTC_MSG_TXT_CBS_IDX rebuild partition p2 online;alter index SFMSBR.MTC_MSG_TXT_CBS_IDX rebuild partition p3 online;ALTER INDEX indexName MONITORING USAGE;V$OBJECT_USAGE################################################################################################################# @pointintimerecovery:--------------RMAN> recover tablespace "TEST" until SCN 4515327 auxiliary destination '+DATA';select timestamp_to_scn(sysdate) from dual;#########################################################################@optredo:-------------The default size of the redo log buffer is calculated as follows:MAX(0.5M, (128K * number of cpus))#####################################################################################################################ourskil:select sql_id,hash_value,plan_hash_value from v$sql where sql_text='select * from scott.dept where deptno=40';#################################################################################################################@oskill:$ kill -9 `ps -ef | grep LOCAL=YES | grep -v grep | awk '{print $2}'`##################################################################################################################3shrink:set linesize 1000 pagesize 0 feedback off trimspool onwithhwm as (-- get highest block id from each datafiles ( from x$ktfbue as we don't need all joins from dba_extents )select /*+ materialize */ ktfbuesegtsn ts#,ktfbuefno relative_fno,max(ktfbuebno+ktfbueblks-1) hwm_blocksfrom sys.x$ktfbue group by ktfbuefno,ktfbuesegtsn),hwmts as (-- join ts# with tablespace_nameselect name tablespace_name,relative_fno,hwm_blocksfrom hwm join v$tablespace using(ts#)),hwmdf as (-- join with datafiles, put 5M minimum for datafiles with no extentsselect file_name,nvl(hwm_blocks*(bytes/blocks),5*1024*1024) hwm_bytes,bytes,autoextensible,maxbytesfrom hwmts right join dba_data_files using(tablespace_name,relative_fno))selectcase when autoextensible='YES' and maxbytes>=bytesthen -- we generate resize statements only if autoextensible can grow back to current size'/* reclaim '||to_char(ceil((bytes-hwm_bytes)/1024/1024),999999)||'M from '||to_char(ceil(bytes/1024/1024),999999)||'M */ '||'alter database datafile '''||file_name||''' resize '||ceil(hwm_bytes/1024/1024)||'M;'else -- generate only a comment when autoextensible is off'/* reclaim '||to_char(ceil((bytes-hwm_bytes)/1024/1024),999999)||'M from '||to_char(ceil(bytes/1024/1024),999999)||'M after setting autoextensible maxsize higher than current size for file '|| file_name||' */'end SQLfrom hwmdfwherebytes-hwm_bytes>1024*1024 -- resize only if at least 1MB can be reclaimedorder by bytes-hwm_bytes desc/###############################################cloneraj:--------1 Take backup of source database 2. Copy backup pieces to target host machine.3. Create pfile from spfile (source machine)create pfile='<path/init<service>.ora' from spfile;4. Copy pfile to target machine ($ORACLE_HOME/dbs/)5. Remove all entries related to instance 26. Change cluster_database=false*.cluster_database=false7. Specify the contorl file path in pfile*.control_files='+REDO01/<DBNAME>/CONTROLFILE/ctrl01.dbf','+REDO02/<DBNAME>/CONTROLFILE/ctrl02.dbf'8. Change DB_NAME to duplicater DB name and db_create_file_dest='+DATADG' 8. Change instane_number =1<DBNAME>.instance_number=19. Add entry for remote_listener in pfile*.remote_listener='ptrandr-scan.mcsl.in:1526'MPUTDB.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.88.11.21)(PORT=1526))'10. Create password file for target database.orapwd file=/oracle/product/11.2.0/db/dbs/orapw<DBNAME> password=<password> entries=1011. Create adump dir in target servermkdir -p /oracle/product/admin/<DBNAME>/adump12. Setup the environment variables and startup nomountORACLE_SID=<DB_NAME>; export ORACLE_SIDsqlplus / as sysdbaSTARTUP NOMOUNT;exit13.Connect RMAN with Auxiliary databaserman AUXILIARY /RMAN>DUPLICATE DATABASE TO MPSWSDB BACKUP LOCATION '/DBtemp/070914/MPPWSDB_20140907/';for standby :- DUPLICATE TARGET DATABASEFOR STANDBY BACKUP LOCATION '/DBtemp/MPPBSDB/' ;DUPLICATE TARGET DATABASE FOR STANDBY BACKUP LOCATION '/DBtemp/MPPBSDB/'DB_FILE_NAME_CONVERT='+DATA','+DATADG';14. Once duplication complete, you would get error in alert log that unable to create spfile.15. Stop database and restart with pfile.RMAN> shutdown database16.Startup the database from pfile.17. Create spfile from pfile.CREATE SPFILE='+DATA/<DBNAME>/spfile<DBNAME>.ora' from pfile;18. Edit pfile with spfile entry.SPFILE='+DATA/<DBNAME>/spfile<DBNAME>.ora' 19. Unregister and Register DBsrvctl add database -d <DBNAME> -o /oracle/product/11.2.0/db -c RACONENODE -i <INSTANCE_NAME> -e mcslin-mum-air-dr-ptrandb1.mcsl.in20. Start DB with srvctlsrvctl start database -d <DBNAME>######################################################################3@dytbs:-----------select 'create tablespace ' || df.tablespace_name || chr(10)|| ' datafile ''' || df.file_name || ''' size ' || df.bytes || decode(autoextensible,'N',null, chr(10) || ' autoextend on maxsize ' || maxbytes) || chr(10) || 'default storage ( initial ' || initial_extent || decode (next_extent, null, null, ' next ' || next_extent )|| ' minextents ' || min_extents|| ' maxextents ' || decode(max_extents,'2147483645','unlimited',max_extents) || ') ;'from dba_data_files df, dba_tablespaces twhere df.tablespace_name=t.tablespace_name /######################################################################################@order:--------bash-4.2$ cat order.sqlset serveroutput on size 50000set echo off feed off veri offaccept SID prompt 'Enter Oracle SID: 'DECLAREv_sid number;s sys.v_$session%ROWTYPE;p sys.v_$process%ROWTYPE;BEGINbeginselect sid into v_sidfrom sys.v_$session swhere sid = &&SID;exceptionwhen no_data_found thendbms_output.put_line('Unable to find SID &&SID!!!');return;when others thendbms_output.put_line(sqlerrm||'naaaaaaaaaaaaaaaaaaaaa');return;end; select * into s from sys.v_$session where sid = v_sid;select * into p from sys.v_$process where addr = s.paddr; dbms_output.put_line('=====================================================================');dbms_output.put_line('SID/Serial : '|| s.sid||','||s.serial#);dbms_output.put_line('Foreground : '|| 'PID: '||s.process||' - '||s.program);dbms_output.put_line('Shadow : '|| 'PID: '||p.spid||' - '||p.program);dbms_output.put_line('Terminal : '|| s.terminal || '/ ' || p.terminal);dbms_output.put_line('OS User : '|| s.osuser||' on '||s.machine);dbms_output.put_line('Ora User : '|| s.username);dbms_output.put_line('Status Flags: '|| s.status||' '||s.server||' '||s.type);dbms_output.put_line('Tran Active : '|| nvl(s.taddr, 'NONE'));dbms_output.put_line('Login Time : '|| to_char(s.logon_time, 'Dy HH24:MI:SS'));dbms_output.put_line('Last Call : '|| to_char(sysdate-(s.last_call_et/60/60/24), 'Dy HH24:MI:SS') || ' - ' || to_char(s.last_call_et/60, '9999999999.0') || ' min');dbms_output.put_line('Lock/ Latch : '|| nvl(s.lockwait, 'NONE')||'/ '||nvl(p.latchwait, 'NONE'));dbms_output.put_line('Latch Spin : '|| nvl(p.latchspin, 'NONE')); dbms_output.put_line('Current SQL statement:');for c1 in ( select * from sys.v_$sqltextwhere HASH_VALUE = s.sql_hash_value order by piece) loopdbms_output.put_line(chr(9)||c1.sql_text);end loop; dbms_output.put_line('Previous SQL statement:');for c1 in ( select * from sys.v_$sqltextwhere HASH_VALUE = s.prev_hash_value order by piece) loopdbms_output.put_line(chr(9)||c1.sql_text);end loop; dbms_output.put_line('Session Waits:');for c1 in ( select * from sys.v_$session_wait where sid = s.sid) loopdbms_output.put_line(chr(9)||c1.state||': '||c1.event);end loop; dbms_output.put_line('Connect Info:');for c1 in ( select * from sys.v_$session_connect_info where sid = s.sid) loopdbms_output.put_line(chr(9)||': '||c1.network_service_banner);end loop; dbms_output.put_line('Locks:');for c1 in ( selectdecode(l.type,-- Long locks'TM', 'DML/DATA ENQ', 'TX', 'TRANSAC ENQ','UL', 'PLS USR LOCK',-- Short locks'BL', 'BUF HASH TBL', 'CF', 'CONTROL FILE','CI', 'CROSS INST F', 'DF', 'DATA FILE ','CU', 'CURSOR BIND ','DL', 'DIRECT LOAD ', 'DM', 'MOUNT/STRTUP','DR', 'RECO LOCK ', 'DX', 'DISTRIB TRAN','FS', 'FILE SET ', 'IN', 'INSTANCE NUM','FI', 'SGA OPN FILE','IR', 'INSTCE RECVR', 'IS', 'GET STATE ','IV', 'LIBCACHE INV', 'KK', 'LOG SW KICK ','LS', 'LOG SWITCH ','MM', 'MOUNT DEF ', 'MR', 'MEDIA RECVRY','PF', 'PWFILE ENQ ', 'PR', 'PROCESS STRT','RT', 'REDO THREAD ', 'SC', 'SCN ENQ ','RW', 'ROW WAIT ','SM', 'SMON LOCK ', 'SN', 'SEQNO INSTCE','SQ', 'SEQNO ENQ ', 'ST', 'SPACE TRANSC','SV', 'SEQNO VALUE ', 'TA', 'GENERIC ENQ ','TD', 'DLL ENQ ', 'TE', 'EXTEND SEG ','TS', 'TEMP SEGMENT', 'TT', 'TEMP TABLE ','UN', 'USER NAME ', 'WL', 'WRITE REDO ','TYPE='||l.type) type,decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',4, 'S', 5, 'RSX', 6, 'X',to_char(l.lmode) ) lmode,decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX',4, 'S', 5, 'RSX', 6, 'X',to_char(l.request) ) lrequest,decode(l.type, 'MR', o.object_name,'TD', o.object_name,'TM', o.object_name,'RW', 'FILE#='||substr(l.id1,1,3)||' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,'WL', 'REDO LOG FILE#='||l.id1,'RT', 'THREAD='||l.id1,'TS', decode(l.id2, 0, 'ENQUEUE', 'NEW BLOCK ALLOCATION'),'ID1='||l.id1||' ID2='||l.id2) objnamefrom sys.v_$lock l, dba_objects owhere sid = s.sidand l.id1 = o.object_id(+) ) loopdbms_output.put_line(chr(9)||c1.type||' H: '||c1.lmode||' R: '||c1.lrequest||' - '||c1.objname);end loop; dbms_output.put_line('=====================================================================');END;/undef SID===============================================@movedatafile:RMAN> ;RMAN> SQL 'ALTER TABLESPACE soe OFFLINE';Switch to the new datafile copy(s) and recover the tablespace.RMAN> SWITCH DATAFILE 8 TO COPY;RMAN> RECOVER TABLESPACE soe;RMAN> SQL 'ALTER TABLESPACE soe ONLINE';===================================================================================@cloneothersid:run{backup database format '/u01/rmanbkp/rman_full_%d_%s_%p';backup archivelog all format '/u01/rmanbkp/rman_full_arc_%d_%s_%p';}======ready pfile==========do changes accoring ====> rman auxiliary /run {SET NEWNAME FOR DATABASE TO '/u01/app/oracle/oradata/orcl/%b';SET NEWNAME FOR TEMPFILE 1 TO '/u01/app/oracle/oradata/orcl/temp01.dbf' ;DUPLICATE DATABASE 'RMG' DBID 1604518329 TO ORCL BACKUP LOCATION '/u01/rmanbkp/'LOGFILEGROUP 1 ('/u01/app/oracle/oradata/orcl/redo01a.log','/u01/app/oracle/oradata/orcl/redo01b.log') SIZE 50M REUSE,GROUP 2 ('/u01/app/oracle/oradata/orcl/redo02a.log','/u01/app/oracle/oradata/orcl/redo02b.log') SIZE 50M REUSE,GROUP 3 ('/u01/app/oracle/oradata/orcl/redo03a.log','/u01/app/oracle/oradata/orcl/redo03b.log') SIZE 50M REUSE;}===============================================================================================The following variables are introduced for SET NEWNAME from 11gR2 :- %b The file name remains same as the original. For example, if a datafile is named D:\oracle\oradata\matrix\test.dbf, then %b results in test.dbf.%f Specifies the absolute file number of the datafile for which the new name is generated.%I Specifies the DBID.%N Specifies the tablespace name.%U Specifies the following format: data-D-%d_id-%I_TS-%N_FNO-%f.===============================================================================================@allfiles=========select name from v$tempfileunionselect member from v$logfileunionselect name from v$datafileunionselect name from v$controlfile;======================================@licence: http://www.jobacle.nl/?p=583select 'set newname for datafile '||file#||' to '''||replace(name,'/u01/app/oracle/oradata/orcl/','/data10/oradata/DEVDBNEW/')||''';' from v$datafile;====================================@dbfilecreationcol name for a50select d.creation_time,d.name,t.name from v$datafile d,v$tablespace t where d.ts#=t.ts# order by 1;================================@pass prod & Uat -->oracle-->$4oraTB@storage===============================@asmset wrap offset lines 155 pages 9999col "Group Name" for a6 Head "Group|Name"col "Disk Name" for a10col "State" for a10col "Type" for a10 Head "Diskgroup|Redundancy"col "Total GB" for 9,990 Head "Total|GB"col "Free GB" for 9,990 Head "Free|GB"col "Imbalance" for 99.9 Head "Percent|Imbalance"col "Variance" for 99.9 Head "Percent|Disk Size|Variance"col "MinFree" for 99.9 Head "Minimum|Percent|Free"col "MaxFree" for 99.9 Head "Maximum|Percent|Free"col "DiskCnt" for 9999 Head "Disk|Count"promptprompt ASM Disk Groupsprompt ===============SELECT g.group_number "Group", g.name "Group Name", g.state "State", g.type "Type", g.total_mb/1024 "Total GB", g.free_mb/1024 "Free GB", 100*(max((d.total_mb-d.free_mb)/d.total_mb)-min((d.total_mb-d.free_mb)/d.total_mb))/max((d.total_mb-d.free_mb)/d.total_mb) "Imbalance", 100*(max(d.total_mb)-min(d.total_mb))/max(d.total_mb) "Variance", 100*(min(d.free_mb/d.total_mb)) "MinFree", 100*(max(d.free_mb/d.total_mb)) "MaxFree", count(*) "DiskCnt"FROM v$asm_disk d, v$asm_diskgroup gWHERE d.group_number = g.group_number andd.group_number <> 0 andd.state = 'NORMAL' andd.mount_status = 'CACHED'GROUP BY g.group_number, g.name, g.state, g.type, g.total_mb, g.free_mbORDER BY 1;prompt ASM Disks In Useprompt ================col "Group" for 999col "Disk" for 999col "Header" for a9col "Mode" for a8col "State" for a8col "Created" for a10 Head "Added To|Diskgroup"--col "Redundancy" for a10--col "Failure Group" for a10 Head "Failure|Group"col "Path" for a19--col "ReadTime" for 999999990 Head "Read Time|seconds"--col "WriteTime" for 999999990 Head "Write Time|seconds"--col "BytesRead" for 999990.00 Head "GigaBytes|Read"--col "BytesWrite" for 999990.00 Head "GigaBytes|Written"col "SecsPerRead" for 9.000 Head "Seconds|PerRead"col "SecsPerWrite" for 9.000 Head "Seconds|PerWrite"select group_number "Group", disk_number "Disk", header_status "Header", mode_status "Mode", state "State", create_date "Created"--, redundancy "Redundancy", total_mb/1024 "Total GB", free_mb/1024 "Free GB", name "Disk Name"--, failgroup "Failure Group", path "Path"--, read_time "ReadTime"--, write_time "WriteTime"--, bytes_read/1073741824 "BytesRead"--, bytes_written/1073741824 "BytesWrite", read_time/reads "SecsPerRead", write_time/writes "SecsPerWrite"from v$asm_disk_statwhere header_status not in ('FORMER','CANDIDATE')order by group_number, disk_number/Prompt File Types in DiskgroupsPrompt ========================col "File Type" for a16col "Block Size" for a5 Head "Block|Size"col "Gb" for 9990.00col "Files" for 99990break on "Group Name" skip 1 nodupselect g.name "Group Name", f.TYPE "File Type", f.BLOCK_SIZE/1024||'k' "Block Size", f.STRIPED, count(*) "Files", round(sum(f.BYTES)/(1024*1024*1024),2) "Gb"from v$asm_file f,v$asm_diskgroup gwhere f.group_number=g.group_numbergroup by g.name,f.TYPE,f.BLOCK_SIZE,f.STRIPEDorder by 1,2;clear breakprompt Instances currently accessing these diskgroupsprompt ==============================================col "Instance" form a8select c.group_number "Group", g.name "Group Name", c.instance_name "Instance"from v$asm_client c, v$asm_diskgroup gwhere g.group_number=c.group_number/prompt Free ASM disks and their pathsprompt ==============================col "Disk Size" form a9select header_status "Header", mode_status "Mode", path "Path", lpad(round(os_mb/1024),7)||'Gb' "Disk Size"from v$asm_diskwhere header_status in ('FORMER','CANDIDATE')order by path/prompt Current ASM disk operationsprompt ===========================select *from v$asm_operation/This is how some of the changes lookAdded To Total Free Seconds SecondsGroup Disk Header Mode State Diskgroup GB GB Disk Name Path PerRead PerWrite----- ---- --------- -------- -------- ---------- ------ ------ ---------- ------------------- ------- --------1 0 MEMBER ONLINE NORMAL 20-FEB-09 89 88 FRA_0000 /dev/oracle/disk388 .004 .0021 1 MEMBER ONLINE NORMAL 31-MAY-10 89 88 FRA_0001 /dev/oracle/disk260 .002 .0021 2 MEMBER ONLINE NORMAL 31-MAY-10 89 88 FRA_0002 /dev/oracle/disk260 .007 .0022 15 MEMBER ONLINE NORMAL 04-MAR-10 89 29 DATA_0015 /dev/oracle/disk203 .012 .0232 16 MEMBER ONLINE NORMAL 04-MAR-10 89 29 DATA_0016 /dev/oracle/disk203 .012 .0212 17 MEMBER ONLINE NORMAL 04-MAR-10 89 29 DATA_0017 /dev/oracle/disk203 .007 .0262 27 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0027 /dev/oracle/disk260 .011 .0232 28 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0028 /dev/oracle/disk259 .009 .0202 38 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0038 /dev/oracle/disk190 .012 .0252 39 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0039 /dev/oracle/disk189 .014 .0152 40 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0040 /dev/oracle/disk260 .011 .0242 41 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0041 /dev/oracle/disk260 .009 .0222 42 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0042 /dev/oracle/disk260 .011 .0182 43 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0043 /dev/oracle/disk260 .003 .0262 44 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0044 /dev/oracle/disk260 .008 .0192 45 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0045 /dev/oracle/disk193 .008 .0182 46 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0046 /dev/oracle/disk192 .007 .0242 47 MEMBER ONLINE NORMAL 31-MAY-10 89 30 DATA_0047 /dev/oracle/disk191 .005 .0222 48 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0048 /dev/oracle/disk190 .008 .0212 49 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0049 /dev/oracle/disk189 .008 .0262 50 MEMBER ONLINE NORMAL 31-MAY-10 89 29 DATA_0050 /dev/oracle/disk261 .009 .03056 rows selected.File Types in Diskgroups========================Group BlockName File Type Size STRIPE Files Gb------ ---------------- ----- ------ ------ --------DATA CONTROLFILE 16k FINE 1 0.01DATAFILE 16k COARSE 404 2532.58ONLINELOG 1k FINE 3 6.00PARAMETERFILE 1k COARSE 1 0.00TEMPFILE 16k COARSE 13 440.59FRA AUTOBACKUP 16k COARSE 2 0.02CONTROLFILE 16k FINE 1 0.01ONLINELOG 1k FINE 3 6.00@diskindiskgroupSELECT SUBSTR(d.name,1,16) AS asmdisk, d.mount_status, d.state,dg.name AS diskgroup FROM V$ASM_DISKGROUP dg, V$ASM_DISK d WHERE dg.group_number = d.group_number;@pathstatuscol PATH for a40select PATH, HEADER_STATUS, MODE_STATUS, STATE from v$asm_disk;/@mountstateselect inst_id,path,mount_status,header_status from gv$asm_disk where path='/dev/rhdisk17';=====@digasm/etc/init.d/oracleasm listdisksout:DSK1/etc/init.d/oracleasm querydisk -d dsk1out:Disk "DSK1" is a valid ASM disk on device [8, 17]ls -l /dev |grep 8|grep 17out:brw-r----- 1 root disk 8, 17 Aug 10 13:05 sdb1==========================================@renamedatafileasmRMAN> COPY DATAFILE '+DATA/sfms/datafile/users.290.930691959' to '+DATA/sfms/datafile/users.dbf'; RMAN> switch datafile '+DATA/sfms/datafile/users.290.930691959' to copy;RMAN> recover datafile 5;SQL> alter database datafile 5 online;======================================@isdynamicparameterselect name,isses_modifiable,issys_modifiable,isinstance_modifiable from v$parameter where name like '&memory_max_target'==============================@cpuinfonproc/proc/cupinfo/proc/meminfo======================@tophelpl âTo display or to hide load average linet âTo display or to hide task/cpu line1 âTo display or hide all other CPUâsm âto display or to hide RAM and SWAP detailss âTo change the time interval for updating top results(value is in secâs)R âTo sort by PID numberu â Press u then username to get only that user process detailsP âTo sort by CPU utilizationM âTo sort by RAM utilizationc âTo display or hide command full pathr âTo renice a process, press r then the PID no then the renice value to renice a process.k âTo kill a process, press k then PID number then enter to kill a processw âTo save the modified configuration permanently.q âTo quit the top command.h âfor getting help on top command=======================================================@shrinkset verify offcolumn file_name format a50 word_wrappedcolumn smallest format 999,990 heading "Smallest|Size|Poss."column currsize format 999,990 heading "Current|Size"column savings format 999,990 heading "Poss.|Savings"break on reportcompute sum of savings on reportcolumn value new_val blksizeselect value from v$parameter where name = 'db_block_size';/select file_name,ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) smallest,ceil( blocks*&&blksize/1024/1024) currsize,ceil( blocks*&&blksize/1024/1024) -ceil( (nvl(hwm,1)*&&blksize)/1024/1024 ) savingsfrom dba_data_files a,( select file_id, max(block_id+blocks-1) hwmfrom dba_extentsgroup by file_id ) bwhere a.file_id = b.file_id(+) order by savings desc/=================================================@activeuserlist:select username,account_status,default_tablespace from dba_users where username not in('XDB','TSMSYS','TRACESVR','SYSTEM','SYS','SCOTT','ADAMS','JONES','CLARK','BLAKE','PERFSTAT','OUTLN','ORDSYS','ORDPLUGINS','ORACLE_OCM','MDSYS','LBACSYS','HR','OE','SH','EXFSYS','DSSYS','DMSYS','DIP','DEMO','DBSNMP','CTXSYS','CSMIG','AWR_STAGE','AURORA$ORB$UNAUTHENTICATED','ANONYMOUS') and account_status='OPEN';==============================================@multiblockreadcountThe formula for calculating DB_FILE_MULTIBLOCK_READ_COUNT is:db_file_multiblock_read_count = min(max I/O size/db_block_size , db_cache_size/(sessions * db_block_size))Note: Max I/O size is platform-dependent and equal to 1MB for most platforms========================================================================================================================@large tablecol owner format a15col segment_name format a30col segment_type format a15col gb format 999,999,999select owner, segment_name, segment_type, gbfrom (select owner, segment_name, segment_type, bytes / 1024 / 1024 / 1024 gbfrom dba_segmentswhere segment_type = 'TABLE'order by bytes desc)where rownum < 10;/===========================================================================================================@setdate in linuxdate -s "05JAN2017 11:38:00"=====================================================================@sysdbausersselect * from v$pwfile_users=====================================================================@multiplearchivedestlog_archive_duplex_dest='path'======================@centoshttps://wiki.centos.org/HowTos/Oracle12onCentos7==================================================@workshophttp://dbaworkshop.blogspot.in/p/recovery-scenarios_5.html=====================@imagerman> list copy of database;==========================@checkpoint&scnselect sequence#,first_change#,next_change#,first_time from v$archived_log order by first_time;========================================================@lastscnselect sequence#,first_change#,next_change#,first_time,status from v$log where status='CURRENT';==============================@resetlogshttp://www.dba-oracle.com/t_rman_71_recover_previous_incarnation.htm=============================@restore not done; all files read only, offline, or already restoredsol:restore tablespace example force;===============================@incarnationRMAN> list incarnation of database;SQL> select incarnation#, resetlogs_change# from v$database_incarnation;*****************RMAN> shutdown immediateRMAN> startup mountRMAN> reset database to incarnation 2;database reset to incarnation 2===================================RMAN> list archivelog all===================================@recreate controlfile creationCREATE CONTROLFILE REUSE DATABASE "EWSTEST" NORESETLOGS ARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 2MAXDATAFILES 30MAXINSTANCES 1MAXLOGHISTORY 292LOGFILEGROUP 1 '/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/redo1.log' SIZE 30M BLOCKSIZE 512,GROUP 2 '/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/redo2.log' SIZE 30M BLOCKSIZE 512,GROUP 3 '/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/redo3.log' SIZE 30M BLOCKSIZE 512-- STANDBY LOGFILEDATAFILE'/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/system.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/sysaux.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/undo.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/example01.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/example02.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/bil03.dbf'CHARACTER SET US7ASCII;=====================================@changedbnameCREATE CONTROLFILE REUSE SET DATABASE "EWSTEST" RESETLOGS ARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 2MAXDATAFILES 30MAXINSTANCES 1MAXLOGHISTORY 292LOGFILEGROUP 1 '/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/redo1.log' SIZE 30M BLOCKSIZE 512,GROUP 2 '/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/redo2.log' SIZE 30M BLOCKSIZE 512,GROUP 3 '/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/redo3.log' SIZE 30M BLOCKSIZE 512-- STANDBY LOGFILEDATAFILE'/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/system.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/sysaux.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/undo.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/example01.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/example02.dbf','/u01/app/oracle/product/11.2.0/db_1/oradata/EWSTEST/bil03.dbf'CHARACTER SET US7ASCII;==============================@rmgrepls | grep chrome | xargs rm==============================@rowcount in tableselect 'select count(*) from '||table_name||';' from dba_tables where owner = '&OWNER';============or==================DECLAREval NUMBER;BEGINFOR I IN (SELECT TABLE_NAME FROM USER_TABLES) LOOPEXECUTE IMMEDIATE 'SELECT count(*) FROM ' || i.table_name INTO val;DBMS_OUTPUT.PUT_LINE(i.table_name || ' ==> ' || val );END LOOP;END;/===============or======================set pages 999;col count format 999,999,999;spool countlist.txtselecttable_name,to_number(extractvalue(xmltype(dbms_xmlgen.getxml('select count(*) c from '||table_name)),'/ROWSET/ROW/C')) countfrom user_tablesorder by table_name;==============================================================================@setscnSQL> shutdown immediateSQL>startup mountRMAN> run{set until scn=547891;restore database;recover database;}RMAN> alter database open resetlogs; =========================@minoldfind . -mmin 3 #exactly 3 minutes oldfind . -mmin +3 #more than 3 minutes oldfind . -mmin -3 #less than 3 minutes old.find . -mmin -360 #less than 6 hours old=============================================@sessionprivsselect * from session_privs;=============================================@restrictsysdbaSQLNET.AUTHENTICATION_SERVICES=(NONE)============================================@lastddlSELECT LAST_DDL_TIME, TIMESTAMPFROM USER_OBJECTSWHERE OBJECT_TYPE = 'PROCEDURE'AND OBJECT_NAME = 'MY_PROC';=====================================@wildells -ltr o1_mf_1_2[5-7]*rm -rf o1_mf_1_2[5-7]*======================================@maxtran SELECT ini_trans, max_trans from dba_tables WHERE table_name = 'TEST' ;==================================================================================@degreegatherBEGINSYS.DBMS_STATS.GATHER_TABLE_STATS (OwnName => 'MK2',TabName => 'MIG_CASENAME',Degree => 4,Cascade => TRUE,No_Invalidate => FALSE);END;=========================================================@arupselect sid, state, eventfrom v$sessionwhere username = '&ARUP'; SID STATE EVENT————— ————————————————— ————————————————————————————2832 WAITED KNOWN TIME SQL*Net message from client3346 WAITING enq: TX - row lock contention----------------------------------------------------------------col "Description" format a50select sid,decode(state, 'WAITING','Waiting','Working') state,decode(state,'WAITING','So far '||seconds_in_wait,'Last waited '||wait_time/100)||' secs for '||event"Description"from v$sessionwhere username = '&ARUP';Output:SID STATE Description————— —————————— ———————————————————————————————————————————————————————2832 Working Last waited 2029 secs for SQL*Net message from client3346 Waiting So far 743 secs for enq: TX - row lock contention4208 Waiting So far 5498 secs for SQL*Net message from client----------------------------------------------------select blocking_session B_SID,blocking_instance B_Instfrom v$sessionwhere sid = &3346;B_SID B_INST—————— ———————2832 1----------------------------------------------------------select row_wait_obj#,row_wait_file#,row_wait_block#,row_wait_row#from v$session where sid = &3346;ROW_WAIT_OBJ# ROW_WAIT_FILE# ROW_WAIT_BLOCK# ROW_WAIT_ROW#————————————— —————————————— ———————————————— ——————————————241876 1024 2307623 0-----------------------------------------------------------------------select owner, object_type, object_name, data_object_idfrom dba_objectswhere object_id = &241876;OWNER OBJECT_TYPE OBJECT_NAME DATA_OBJECT_ID————— ———————————— ———————————— ——————————————ARUP TABLE T1 241877------------------------------------------------------------select SID, osuser, machine, terminal, service_name, logon_time, last_call_etfrom v$sessionwhere username = '&ARUP'; -------------------------------------------------------------col username format a5col program format a10col state format a10col last_call_et head 'Called|secs ago' format 999999col seconds_in_wait head 'Waiting|for secs' format 999999col event format a50select sid, username, program,decode(state, 'WAITING', 'Waiting','Working') state,last_call_et, seconds_in_wait, eventfrom v$sessionwhere machine = '&appsvr1'-------------------------------------------------select eventfrom v$sessionwhere sid = &3011;---------------------------------@releaase cat /etc/redhat-release------------------------------------@expirepasswordcreate user manoj identified by manoj1 password expire;====================================================================@nonasmtoasmSQL> select name from v$database;NAME---------YYAPRDSQL> select file_name from dba_data_files;FILE_NAME--------------------------------------------------/u04/oradata/YYAPRD/system01.dbf/u04/oradata/YYAPRD/sysaux01.dbf/u04/oradata/YYAPRD/undotbs01.dbf/u04/oradata/YYAPRD/users01.dbfSQL> select file_name from dba_temp_files;FILE_NAME--------------------------------------------------/u04/oradata/YYAPRD/temp01.dbfSQL> col member form a50SQL> select member from v$logfile;MEMBER--------------------------------------------------/u02/oradata/YYAPRD/redo01a.log/u03/oradata/YYAPRD/redo01b.log/u02/oradata/YYAPRD/redo02a.log/u03/oradata/YYAPRD/redo02b.log/u02/oradata/YYAPRD/redo03a.log/u03/oradata/YYAPRD/redo03b.log6 rows selected.SQL> show parameter spfileNAME TYPE VALUE------------------------------------ -------------------------------- ------------------------------spfile string /u01/app/oracle/product/11.2.0.3/dbs/spfileYYAPRD.oraSQL> show parameter control_fileNAME TYPE VALUE------------------------------------ -------------------------------- ------------------------------control_file_record_keep_time integer 7control_files string /u01/oradata/YYAPRD/control01.ctl, /u02/oradata/YYAPRD/control02.ctl, /u03/oradata/YYAPRD/control03.ctlSQL> alter system set control_files='+DATA','+DATA1' scope=spfile;System altered.SQL> alter system set db_create_file_dest='+DATA' scope=spfile;System altered.SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL>SQL>SQL> startup nomountORACLE instance started.Total System Global Area 2042241024 bytesFixed Size 1345968 bytesVariable Size 838862416 bytesDatabase Buffers 1191182336 bytesRedo Buffers 10850304 bytes[oracle@NODE1 11.2.0.3]$ rman target /Recovery Manager: Release 11.2.0.3.0 - Production on Mon Apr 8 23:24:36 2013Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.connected to target database: YYAPRD (not mounted)RMAN> restore controlfile from '/u01/oradata/YYAPRD/control01.ctl';Starting restore at 08-APR-13using channel ORA_DISK_1channel ORA_DISK_1: copied control file copyoutput file name=+DATA/yyaprd/controlfile/current.256.812244559output file name=+DATA1/yyaprd/controlfile/current.256.812244561Finished restore at 08-APR-13RMAN> alter database mount;database mountedreleased channel: ORA_DISK_1RMAN> backup as copy database format '+DATA';Starting backup at 08-APR-13allocated channel: ORA_DISK_1------RMAN> switch database to copy;datafile 1 switched to datafile copy "+DATA/yyaprd/datafile/system.257.812244625"datafile 2 switched to datafile copy "+DATA/yyaprd/datafile/sysaux.259.812244827"datafile 3 switched to datafile copy "+DATA/yyaprd/datafile/undotbs.260.812244881"datafile 4 switched to datafile copy "+DATA/yyaprd/datafile/users.258.812244721"RMAN> alter database open;database openedRMAN> exitSQL> select file_name from dba_data_files;FILE_NAME--------------------------------------------------+DATA/yyaprd/datafile/system.257.812244625+DATA/yyaprd/datafile/sysaux.259.812244827SQL> alter tablespace temp add tempfile size 500M;Tablespace altered.SQL> select file_name from dba_temp_files;FILE_NAME--------------------------------------------------/u04/oradata/YYAPRD/temp01.dbf+DATA/yyaprd/tempfile/temp.263.812245559SQL> alter database tempfile '/u04/oradata/YYAPRD/temp01.dbf' drop including datafiles;Database altered.SQL> select file_name from dba_temp_files;FILE_NAME--------------------------------------------------+DATA/yyaprd/tempfile/temp.263.812245559SQL> alter database add logfile group 4 ('+DATA','+DATA1') size 10M;Database altered.SQL> alter database add logfile group 5 ('+DATA','+DATA1') size 10M;Database altered.SQL> alter database add logfile group 6 ('+DATA','+DATA1') size 10M;Database altered.SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ----------- ------------ -----------1 1 115 10485760 512 2 NO INACTIVE 244292 08-APR-2013 268271 08-APR-20132 1 116 10485760 512 2 NO INACTIVE 268271 08-APR-2013 271180 08-APR-20133 1 117 10485760 512 2 NO CURRENT 271180 08-APR-2013 2.8147E+144 1 0 10485760 512 2 YES UNUSED 0 05 1 0 10485760 512 2 YES UNUSED 0 06 1 0 10485760 512 2 YES UNUSED 0 0 SQL> alter database drop logfile group 1;Database altered.SQL> alter database drop logfile group 2;Database altered.SQL> alter system switch logfile;System altered.SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ----------- ------------ -----------3 1 117 10485760 512 2 NO INACTIVE 271180 08-APR-2013 274462 08-APR-20134 1 118 10485760 512 2 NO INACTIVE 274462 08-APR-2013 274465 08-APR-20135 1 119 10485760 512 2 NO CURRENT 274465 08-APR-2013 2.8147E+146 1 0 10485760 512 2 YES UNUSED 0 0SQL> alter database drop logfile group 3;Database altered.SQL> select member from v$logfile;MEMBER--------------------------------------------------+DATA/yyaprd/onlinelog/group_4.264.812246035+DATA1/yyaprd/onlinelog/group_4.257.812246037+DATA/yyaprd/onlinelog/group_5.265.812246095+DATA1/yyaprd/onlinelog/group_5.258.812246097======================================================================@asmtononasm==================================================================================@BITgetconf LONG_BIT==================================@GUIyum install xorg-x11-apps.x86_64 =====================================@deinstall./runInstaller -deinstall -home /u01/app/oracle/product/12.1.0/dbhome_1/---------------------$ORACLE_HOME/oui/bin/runInstaller================================================================================@newlycreated SELECT created,object_nameFROM dba_objectsWHERE object_name like '%EWU_USE%'AND owner = 'EWSADMIN'AND object_type = 'TABLE' order by 1;====================================================@perfstatdelDeleting certain SNAP IDsSQL> @?/rdbms/admin/sppurge.sqlDelete all snapshotsSQL> @?/rdbms/admin/sptrunc.sqlDelete the perfstat schemaSQL> @?/rdbms/admin/spdrop.sqlDelete a timerangeSQL> exec statspack.purge (i_begin_date=>to_date('01-JAN-2012', 'DD-MON-YYYY'),i_end_date =>to_date('02-JAN-2012', 'DD-MON-YYYY'),i_extended_purge=>TRUE);=================================or===========================================select SNAP_ID,to_char(SNAP_TIME,'dd-mon-yyyy hh24:mi') from stats$snapshot;delete from stats$snapshot where SNAP_TIME < sysdate - (1/(24*60)) ;=============================================================================================================================================================================================================@resetsamepassword:select password from sys.user$ where name='&QWERTY';PASSWORD-----------------------------87FE2DD49B2882B2alter user QWERTY identified by values '87FE2DD49B2882B2';=======================================================================@windowsprofile:set PATH=%ORACLE_HOME%\perl\bin;%PATH% path=%path%;E:\app\Administrator\product\11.2.0\dbhome_1\OPatch===============================================@list of directoriesls -ltr | grep "^d"=====================================================@7of7zipfile1-Db2-Db3-Grid4-Client5-Oracle Gateways6-Oracle Examples7-Deinstall================================================================================@indexsstatusselect OWNER,INDEX_NAME,owner,status,table_name from dba_indexes where owner like %PMD%';SELECT index_name,status,Blevel,LEAF_BLOCKS,DISTINCT_KEYS,NUM_ROWS,CLUSTERING_FACTOR FROM DBA_INDEXES WHERE index_name = 'ORGANIZED_IDX';===================================================================================================================================@tabstatsEXEC DBMS_STATS.gather_table_stats('PMD', 'VW_DAG_0',cascade => true,estimate_percent => dbms_stats.auto_sample_size);============================================================================================@redomultiplexingalter database add logfile member '/u03/app/oracle/oradata/orcl/redo/redo01_b.log' to group 1;ALTER DATABASE ADD LOGFILE group 7 ('/u02/oradata/P38/redo07a.log', '/u03/oradata/P38/redo07b.log') size 100m;http://www.oracledistilled.com/oracle-database/administration/multiplexing-the-redo-log-files/ --multiplexingalter database add logfile member '/u03/app/oracle/oradata/orcl/redo/redo01_b.log' to group 1;https://muneer2908.wordpress.com/2011/01/27/how-to-change-the-redo-log-file-size-in-oracle-database/ --increase size======================================@nlsSELECT * FROM NLS_DATABASE_PARAMETERS;select * from nls_database_parameters where parameter='NLS_CHARACTERSET';========================================@cachefusion:@sess_stats.sqlSELECT sn.name,st.valueFROM v$statname snJOIN v$sesstat stON sn.STATISTIC#=st.STATISTIC#WHERE sn.name IN ('session logical reads','physical reads','gc cr block received','gc current block received')AND st.sid=SYS_CONTEXT('USERENV','SID')ORDER BY sn.STATISTIC#;-------------------------------------------------------@tracemysession declarev_sid number;v_serial number;beginselect sid,serial# into v_sid,v_serial from v$sessionwhere sid=SYS_CONTEXT('USERENV','SID');dbms_monitor.session_trace_enable(v_sid,v_serial,TRUE,TRUE);end;-----------------------------@mytracefileselectpm.value ||'/diag/rdbms/'||d.name||'/'||i.instance_name||'/trace/'||i.instance_name||'_ora_'||pr.spid||'.trc' as trace_filefrom(selectp.spidfromv$session sjoinv$process pon s.paddr=p.addrwheres.sid=SYS_CONTEXT('USERENV','SID')) prcross join(selectvaluefrom v$parameterwhere name='diagnostic_dest') pmcross join(select instance_namefrom v$instance) icross join(selectlower(name) as namefrom v$database) d;-----------------------------------------------------------------------@mysidselect SYS_CONTEXT('USERENV','SID') from dual;select SYS_CONTEXT('USERENV','CURRENT_USER') from dual;@traceenableexec DBMS_SYSTEM.SET_SQL_TRACE_IN_SESSION(sid,serial#,true);------------------------------------------------------------------@optsession@opttransactionsession= (1.1 * PROCESSES) + 5transaction= (1.1 * SESSIONS)---------------------------------------------------------------------------@service :A service is a logical grouping of sessions performing similar kind of work.$srvctl add service -s test -d hrms -r hrms1 -a hrms2 -P basic r=prefer#to see status of specific service$srvctl status service -s test -d hrms#to delete service$srvctl remove service -s test -d hrms--------------@modify servicesrvctl modify service -d RTGS -s myser -n -i RTGS1,RTGS2srvctl add service -d testing -s testsrv -r testing2,testing1-----------------------------------------select service_name,inst_id,count(*)from gv$sessiongroup by service_name,inst_idorder by service_name,inst_id;----------------select name from v$services-----------@findvipolsnodes -i --------@clientsysdbasqlplus sys/SYS123@OCAS as sysdba-------------------------------------------@adrcipurge -age 43200 (older then one month)adrci>show alert -tail -fadrci>show homeadrci>set homepath diag/rdbms/orclbi/orclbi2--------------------------------------------------------------------------------------------------------------------------------------------------------------------------@ptselect sid,event,p1,p2,p3 from v$session_wait where event='db file sequential read'; select owner,segment_name,segment_type from dba_extents where file_id= 21 and 969567 between block_id and block_id + blocks -1;-----------------------------------------------------------------------------------@blkid----------------------------------------------------------------------------------@sysauxpurgeset linesize 120set pagesize 100COLUMN "Item" FORMAT A25COLUMN "Space Used (GB)" FORMAT 999.99COLUMN "Schema" FORMAT A25COLUMN "Move Procedure" FORMAT A40SELECT occupant_name "Item",space_usage_kbytes/1048576 "Space Used (GB)",schema_name "Schema",move_procedure "Move Procedure"FROM v$sysaux_occupantsORDER BY 1/--How long old stats are kept1select dbms_stats.get_stats_history_retention from dual;--Set retention of old stats to 10 days1exec dbms_stats.alter_stats_history_retention(10);--Purge stats older than 10 days (best to do this in stages if there is a lot of data (sysdate-30,sydate-25 etc)1exec DBMS_STATS.PURGE_STATS(SYSDATE-10);--Show available stats that have not been purged1select dbms_stats.get_stats_history_availability from dual;--Show how big the tables are and rebuild after stats have been purgedhttps://jhdba.wordpress.com/2009/05/19/purging-statistics-from-the-sysaux-tablespace/--------------------------------------------------------------@htmlset markup html onset pagesize 30spool processes_sessions.htmlselectp.username "V$PROCESS - OS USERNAME",p.terminal,p.program,s.username "V$SESSION - USERNAME",s.command,s.status,to_char(s.LOGON_TIME,'DD-MON-YY HH24:MI:SS') "LOGON TIME",s.LAST_CALL_ET/60 "LAST_CALL TIME",s.server,s.process,s.machine,s.port,s.terminal,s.program,s.sid,s.serial#,p.spidFROM v$session s,v$process pWHERE p.addr=s.paddrorder by p.background desc;spool offexit; ---------------------------------------------------------------------------------------------------------@audit(schema)https://oracle-base.com/articles/10g/auditing-10gr2SHOW PARAMETER AUDITAUDIT_TRAIL = { none | os | db | db,extended | xml | xml,extended }ALTER SYSTEM SET audit_trail=db SCOPE=SPFILE; bounce dbCONNECT sys/password AS SYSDBA--priAUDIT ALL BY SCOTT BY ACCESS;AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY SCOTT BY ACCESS;AUDIT EXECUTE PROCEDURE BY SCOTT BY ACCESS;---dictionary tab infoSELECT view_name FROM dba_views WHERE view_name LIKE 'DBA%AUDIT%' ORDER BY view_name;---check auditCOLUMN username FORMAT A10COLUMN owner FORMAT A10COLUMN obj_name FORMAT A10COLUMN extended_timestamp FORMAT A35SELECT username,extended_timestamp,owner,obj_name,action_nameFROM dba_audit_trailWHERE owner = 'AUDIT_TEST'ORDER BY timestamp;----------------------------@audithousekeepinghttps://oracle-base.com/articles/11g/auditing-enhancements-11gr2 ----------------------------------------------------------------------------------------------------------------@mastertableissueSET lines 150COL owner_name FORMAT a10COL job_name FORMAT a20COL operation FORMAT a10SELECT owner_name, job_name, operationFROM dba_datapump_jobs where state='NOT RUNNING' and attached_sessions=0;set head offSELECT 'drop table ' || owner_name || '.' || job_name || ';'FROM dba_datapump_jobs WHERE state='NOT RUNNING' and attached_sessions=0;--------------------------------------------------------------------------------------------------------------@HOW TO GENERATE ARCHIVE LOG FROM ASM TO LOCAL DISKSQL> CREATE or replace DIRECTORY archdir AS '+ARCH/mscdxb/arch/';SQL> Directory created.SQL> CREATE or replace DIRECTORY tempdir AS '/u01/starch/';Directory created.spool archmove.sqlset linesize 250set pagesize 250select 'EXECUTE DBMS_FILE_TRANSFER.COPY_FILE(''ARCHDIR'','''||SUBSTR(NAME,INSTR(NAME,'/',-1) + 1) ||''',''TEMPDIR'','''||SUBSTR(NAME,INSTR(NAME,'/',-1) + 1)||''');'FROM V$ARCHIVED_LOG where name is not null;spool off;exit;----------------------------------------------------------------------------------------------------------------@aixinstallation:kernal: # lsattr -E -l sys0 -a maxuproc maxuproc 128 Maximum number of PROCESSES allowed per user True# smit chgsys ( Change / Show Characteristics of Operating System)#chdev -l sys0 -a maxuproc=1000# getconf -aAIO_LISTIO_MAX: 4096AIO_MAX: 4096AIO_PRIO_DELTA_MAX: 0ARG_MAX: 24576# bootinfo -K (64 or 32)# /usr/bin/getconf HARDWARE_BITMODE --(To determine if the system architecture)# /usr/sbin/lsps -a (To determine swap)# /usr/sbin/lsattr -E -l sys0 -a realmem (To determine the RAM size)----------------------------------------------------------------------------ERROR at line 1:ORA-20005: object statistics are locked (stattype = ALL)ORA-06512: at "SYS.DBMS_STATS", line 24281ORA-06512: at "SYS.DBMS_STATS", line 24332ORA-06512: at line 1------------------------ sol-------------------exec dbms_stats.unlock_table_stats('EWSADMIN', 'EWN_COMP_MODEL_SCORE');-------------------------------------------------------------------------------@dbfutilizationSET PAUSE ONSET PAUSE 'Press Return to Continue'SET PAGESIZE 60SET LINESIZE 300COLUMN "Tablespace Name" FORMAT A20COLUMN "File Name" FORMAT A80SELECT Substr(df.tablespace_name,1,20) "Tablespace Name",Substr(df.file_name,1,80) "File Name",Round(df.bytes/1024/1024,0) "Size (M)",decode(e.used_bytes,NULL,0,Round(e.used_bytes/1024/1024,0)) "Used (M)",decode(f.free_bytes,NULL,0,Round(f.free_bytes/1024/1024,0)) "Free (M)",decode(e.used_bytes,NULL,0,Round((e.used_bytes/df.bytes)*100,0)) "% Used"FROM DBA_DATA_FILES DF,(SELECT file_id,sum(bytes) used_bytesFROM dba_extentsGROUP by file_id) E,(SELECT Max(bytes) free_bytes,file_idFROM dba_free_spaceGROUP BY file_id) fWHERE e.file_id (+) = df.file_idAND df.file_id = f.file_id (+)ORDER BY df.tablespace_name,df.file_name/-------------------------------------------------------------------------------------------------------------@allocaterestore:run {allocate channel ch1 device type 'sbt';allocate channel ch2 device type 'sbt';allocate channel ch3 device type 'sbt';send 'NB_ORA_POLICY=DB_rman_full,NB_ORA_SERV=master-bk';restore database;release channel ch1;release channel ch2;release channel ch3;}----------------------asm to nonasm-----------run{set newname for datafile 1 to '/data/emrep/oradata/EMREP/datafile/system.283.903890003';set newname for datafile 2 to '/data/emrep/oradata/EMREP/datafile/sysaux.278.903889977';set newname for datafile 3 to '/data/emrep/oradata/EMREP/datafile/undotbs1.282.903890003';set newname for datafile 4 to '/data/emrep/oradata/EMREP/datafile/users.285.903890027';set newname for datafile 5 to '/data/emrep/oradata/EMREP/datafile/mgmt_ecm_depot_ts.281.903890003';set newname for datafile 6 to '/data/emrep/oradata/EMREP/datafile/mgmt_tablespace.284.903890027';set newname for datafile 7 to '/data/emrep/oradata/EMREP/datafile/mgmt_ad4j_ts.280.903889977';set newname for datafile 8 to '/data/emrep/oradata/EMREP/datafile/rman_catalog.279.903889977';set newname for datafile 9 to '/data/emrep/oradata/EMREP/datafile/mgmt_tablespace.499.916503681';SET NEWNAME FOR TEMPFILE 1 TO '/data/emrep/oradata/EMREP/datafile/temp01.dbf';set until scn 658140403;DUPLICATE TARGET DATABASE TO EMREPNOFILENAMECHECKDB_FILE_NAME_CONVERT '+DATA','/data/emrep/oradata/EMREP/datafile'LOGFILEGROUP 1 ('/data/emrep/onlinelog/EM_GRIDP03/redo01a.log','/data/emrep/onlinelog/EM_GRIDP03/redo01b.log') SIZE 600M REUSE,GROUP 2 ('/data/emrep/onlinelog/EM_GRIDP03/redo02a.log','/data/emrep/onlinelog/EM_GRIDP03/redo02b.log') SIZE 600M REUSESPFILESET LOG_FILE_NAME_CONVERT '+FRA/','/data/emrep/onlinelog', '+DATA','/data/emrep/onlinelog'SET AUDIT_FILE_DEST '/app/oracle/admin/EMREP/adump'SET CONTROL_FILES '/data/emrep/oradata/EMREP/controlfile/control01.ctl'SET DB_RECOVERY_FILE_DEST '/data/emrep/FRA'SET DB_CREATE_FILE_DEST '/data/emrep/oradata/EMREP/datafile/'SET DIAGNOSTIC_DEST '/app/oracle/admin';}-----------------------------------------------------------------@bandwidthLet us assume the redo rate is a 500 KB/sec.Required bandwidth = ((Redo rate bytes per sec. / 0.75) * 8) / 1,000,000 = bandwidth in Mbps Required bandwidth = ((512000/0.75) * 8) /1,000,000 Required bandwidth = 5.46 MbpsAlso you can find the Minimum and Maximum Bandwidth limit using the below query,SELECT DT,SUM(RB*8/3600000000*1.3) TOTAL_Mbps_REQ_FOR_A_DAY,MIN(RB*8/3600000000*1.3) MIN_Mbps_REQ_FOR_AN_HOUR,MAX(RB*8/3600000000*1.3) MAX_Mbps_REQ_FOR_AN_HOUR ,AVG(RB*8/3600000000*1.3) AVG_Mbps_REQ_FOR_AN_HOURFROM(SELECT TRUNC (COMPLETION_TIME) DT,TO_CHAR (COMPLETION_TIME,'HH24') HH,SUM(BLOCKS*BLOCK_SIZE) RBFROMV$ARCHIVED_LOGWHERE COMPLETION_TIME > SYSDATE-5AND DEST_ID=1GROUP BY TRUNC(COMPLETION_TIME),TO_CHAR (COMPLETION_TIME, 'HH24'))GROUP BY DT;Reference:How To Calculate The Required Network Bandwidth Transfer Of Redo In Data Guard Environments (Doc ID 736755.1)As an Alternative you can also get the 'Redo rate bytes per sec.' from V$SYSMETRIC_HISTORY, eg.SQL> select * from v$sysmetric_history where metric_name = 'Redo Generated Per Sec';------------------------------------------------------------------------------------@indexonwhichcolumnSELECT * FROM dba_ind_columns t where t.table_owner='EWSADMIN'------------------------------------------------------------------------------------@flashbackSELECT FLASHBACK_ON FROM V$DATABASE;ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=4320; -- 3 days default is 1440ALTER DATABASE FLASHBACK ON;-----------------------------------------------------------------------------@$ORACLE_HOME/rdbms/admin/sqltrpt.sql--------------------------------@compilepackage ALTER PACKAGE UTL_FILE COMPILE BODY;--------------------------------@changehomehttps://pierreforstmanndotcom.wordpress.com/2014/09/30/how-to-move-or-rename-oracle-home/---------------------------------------------@telnetexitctl+]telnet > quit*********************************************************************************************************************@spusteps:http://ermanarslan.blogspot.in/2016/11/rdbms-applying-db-psu-and-ojvm-psu-to.html*Shutdown listener and Databases running from target ORACLE HOME*Add opatch to the path ($PATH env variable)export PATH=$PATH:$ORACLE_HOME/OPatch--export PATH=$ORACLE_HOME/OPatch:$PATHopatch lsinventory -detailopatch lsinventoryopatch version/home/oracle/oracle_11204/psu/24006111*PREREQ & CONFLICT CHECK[oracle@coinactdbtst 24006111]$ opatch prereq CheckConflictAmongPatchesWithDetail -phBaseDir /home/oracle/25879656*WE APPLY PSU using Opatch applyexport PATH=$PATH:$ORACLE_HOME/OPatchcsd /home/oracle/oracle_11204/psu/24006111opatch apply*********rollback*********opatch rollback -id 15941858***********@rpatch***************export CRS_ORA_HOME=/opt/oracrs/oragrid/11.2.0.4 export ORACLE_HOME=/opt/oracle/product/11.2.0.4 export PATH=$PATH:$ORACLE_HOME/Opatch cd /orastage/PSU/PSU_PATCH_OCT_2016NPRD:oracle@ausyd23db05cn01:>ls -trltotal 798464-rw-r--r-- 1 oracle oinstall 105489166 Nov 15 16:42 p24006111_112040_Linux-x86-64-RDBMS.zip-rw-r--r-- 1 oracle oinstall 712035213 Nov 15 16:51 p24436338_112040_Linux-x86-64-GI.zipdrwxrwxr-x 3 oracle oinstall 3896 Nov 17 18:09 RDBMS_PSU/drwxrwxr-x 3 oracle oinstall 3896 Nov 17 18:09 GI_PSU/unzip p24006111_112040_Linux-x86-64-RDBMS.zip -d RDBMS_PSUunzip p24436338_112040_Linux-x86-64-GI.zip -d GI_PSU -- Stop agents on all nodescd /opt/oracle/product/agent/core/12.1.0.5.0/bin/./emctl status agent./emctl stop agent-- unix Team to stop crs service, only node one$CRS_ORA_HOME/bin/crsctl stop crsexport CRS_ORA_HOME=/opt/oracrs/oragrid/11.2.0.4 export ORACLE_HOME=/opt/oracle/product/11.2.0.4 export PATH=$PATH:$ORACLE_HOME/Opatch /opt/oracrs/oragrid/11.2.0.4/bin/crsctl stop crs-- crosscheck above command $lsof |grep /opt/oracle/product/1120-----------------------------------------------cd $CRS_ORA_HOME>> from node1 and all other nodescd /opt/oracrs/oragrid/11.2.0.4 tar -cvpf /ora_conv/ora_node1_bak_11.2.0.4/gi_bkp_n1.tar ./cd $ORACLE_HOME>> from node1 and all other nodescd /opt/oracle/product/11.2.0.4 tar -cvpf /ora_conv/ora_node1_bak_11.2.0.4/db_bkp_n1.tar ./$** As Oracle user **cd /opt/oracle/oraInventory>> from node1 and all other nodescd /opt/oracle/oraInventorytar -cvpf /ora_conv/ora_node1_bak_11.2.0.4/inv_bkp_n1.tar ./-- crontab backup and comment all jobs on both nodes..<<flag-1>> /ora_conv/ora_node1_bak_11.2.0.4 cd /opt/oracrs/oragrid/11.2.0.4 tar -cvpf /ora_conv/oradata/node1_bak/gi_bkp_n1.tar ./cd /opt/oracle/product/11.2.0.4 tar -cvpf /ora_conv/oradata/node1_bak/db_bkp_n1.tar ./cd /opt/oracle/oraInventorytar -cvpf /ora_conv/oradata/node1_bak/inv_bkp_n1.tar ./-- unix Team to start crs service.$CRS_ORA_HOME/bin/crsctl start crs/opt/oracrs/oragrid/11.2.0.4/bin/crsctl start crsexport CRS_ORA_HOME=/opt/oracrs/oragrid/11.2.0.4 export ORACLE_HOME=/opt/oracle/product/11.2.0.4 export PATH=$PATH:$ORACLE_HOME/Opatch /opt/oracrs/oragrid/11.2.0.4/bin/crsctl start crs-- Make OCM Configuration (make response file)cd $CRS_ORA_HOME/OPatch/ocm/bin/./emocmrsp-- Validation of Oracle Inventory / If the below command succeeds, we are good /$CRS_ORA_HOME/OPatch/opatch lsinventory -detail -oh $CRS_ORA_HOME$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME-- ** As Root user ** / might not required in rare case /$ORACLE_HOME/crs/install/rootcrs.pl -unlock$ORACLE_HOME/crs/install/roothas.pl -unlockopatch lsinventory | grep 25476126**************** GRID and DATABASE Home Patching **************** 25476126--- Apply auto patch on GRID and RDBMS in one go$CRS_ORA_HOME/OPatch/opatch auto /orastage/PSU/PSU_PATCH_APR_2017/GI_PSU/25476126 -ocmrf $CRS_ORA_HOME/OPatch/ocm/bin/ocm.rsp/opt/oracrs/oragrid/11.2.0.4export CRS_ORA_HOME=/opt/oracrs/oragrid/11.2.0.4 export ORACLE_HOME=/opt/oracle/product/11.2.0.4 export PATH=$PATH:$ORACLE_HOME/Opatch /opt/oracrs/oragrid/11.2.0.4/OPatch/opatch auto /orastage/PSU/PSU_PATCH_APR_2017/GI_PSU/25476126 -ocmrf /opt/oracrs/oragrid/11.2.0.4/OPatch/ocm/bin/ocm.rsp {after sucess of this directly jump to > * DATABASE Patching } -- Apply patch on GRID (make below comand in a file, and ask unix team to execute)$CRS_ORA_HOME/OPatch/opatch auto <patch_location>/GI_PSU -oh $CRS_ORA_HOME -ocmrf $CRS_ORA_HOME/OPatch/ocm/bin/ocm.rsp**************** DATABASE Patching **************** This need to be done, on all database either of the nodes.vi db_patch_apply.sqlset lines 132 pages 300set serveroutput onset sqlbl on exec dbms_output.put_line('***PSU Status before PATCH ***');select name from v$database;col ACTION_TIME for a30col COMMENTS for a30col BUNDLE_SERIES for a10select ACTION_TIME, comments, version, bundle_seriesfrom sys.registry$historywhere bundle_series = 'PSU'order by action_time desc;@?/rdbms/admin/catbundle.sql psu apply@?/rdbms/admin/utlrp.sqlexec dbms_output.put_line('***PSU Status after PATCH ***');set lines 132 pages 300col ACTION_TIME for a30col COMMENTS for a30col BUNDLE_SERIES for a10select ACTION_TIME, comments, version, bundle_seriesfrom sys.registry$historywhere bundle_series = 'PSU'order by action_time desc;exitnohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out & ==========================export ORACLE_SID=DSPCAN101nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLPSYD201nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDSYD121nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out & export ORACLE_SID=OLDCAN021nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDCAN051nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=DSDCAN021nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDCAN031nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDSYD111nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=DSDCAN031nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDSYD131nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=CTLGDB1nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDCAN041nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDSYD091nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=DSDCAN051nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=DSDCAN041nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &export ORACLE_SID=OLDSYD081nohup sqlplus "/ as sysdba" @db_patch_apply.sql > nohup_db_patch_apply_$ORACLE_SID.out &***********************************************************************************************************************************set lines 200set pages 200set time oncol ACTION_TIME for a35col ACTION for a12col NAMESPACE for a12col VERSION for a12col COMMENTS for a30col BUNDLE_SERIES for a10select * from registry$history;-------------------------------------------------------------------------------@afterupgraderemove1.export old homeexport ORACLE_HOME=$OLD_GI_HOME2.$OLD_GI_HOME/oui/bin/runInstaller -detachHome -silent ORACLE_HOME=$OLD_GI_HOME--/home/oracle/app/oracle/product/11.2.0/dbhome/oui/bin/runInstaller -detachHome -silent ORACLE_HOME=$ORACLE_HOME## confirm $OLD_HOME is removed from central inventory:$OLD_GI_HOME/OPatch/opatch lsinventory -all ## remove files in OLD_HOME manually:/bin/rm -rf $OLD_GI_HOMEunset ORACLE_HOME-------------------------------------------------------------------------------@objnameindatafileHow can we check in which datafile my object resides?select a.segment_name,a.file_id,b.file_name Datafile_name from dba_extents a,dba_data_files b where a.file_id=b.file_id and a.segment_name='YOUR OBJECT NAME';How can we check what objects are there in a datafile?select a.segment_name,a.file_id,b.file_name Datafile_name from dba_extents a,dba_data_files b where a.file_id=b.file_id and b.file_name=<your datafile name with path>;--------------------------------------------------------------------------------------@getpasswordselect'alter user "'||username||'" identified by values '''||extract(xmltype(dbms_metadata.get_xml('USER',username)),'//USER_T/PASSWORD/text()').getStringVal()||''';' old_passwordfromdba_userswhereusername = '&WATADMIN';----------------------------------------------------------------------------------------------------@prelimsqlplus -prelim / as sysdbaoradebug setmypidoradebug unlimit;oradebug dump systemstate 266...wait for 2 minsoradebug dump systemstate 266oradebug tracefile_name <=== To check the dump file locationexit -------------------------------------------------------------------------------------------------------------------------------@oradimoradim -new -sid ORCL -syspwd mgrorcl -startmode auto -pfile C:\app\mgrvinod\product\11.2.0\dbhome_1\dbs\init_orcl.ora;-------------------------@CSSD won’t start automatically[oracle@Linux4 ~]$ crsctl stat res ora.cssd -p[oracle@Linux4 ~]$ crsctl modify resource "ora.cssd" -attr "AUTO_START=always"[oracle@Linux4 ~]$ crsctl modify resource "ora.asm" -attr "AUTO_START=always"@end--------------------------*************************************************https://dbdwell.wordpress.com/category/rac/***************************************************http://select-star-from.blogspot.in/2013/07/oracle-dba-interview-questions-answers_24.html***************************************************http://oracle4ryou.blogspot.in/2013/11/oracle-11g-rac-interview-question-and.html***************************************************http://www.freeoraclehelp.com/2011/12/scan-setup-for-oracle-11g-release211gr2.html***************************************************http://ranjeetwipro.blogspot.in/2011/03/rolling-patch-opatch-support-for-rac.html***************************************************https://anargodjaev.wordpress.com/2015/03/10/ra-01503-ora-01189-when-trying-to-recreate-controlfile/***************************************************http://dbarohit.blogspot.in/2012/12/why-oracle-recommends-voting-disks-in_25.html***************************************************https://oracle-base.com/articles/linux/udev-scsi-rules-configuration-in-oracle-linux***************************************************http://expertoracle.com/2014/04/01/data-guard-broker-basics/***************************************************http://oracleinstance.blogspot.in/2012/01/create-single-instance-standby-database.html***************************************************http://www.oracleracexpert.com/2014/01/optimal-redo-logfile-size-in-oracle.html***************************************************https://martincarstenbach.wordpress.com/2010/04/30/applying-psu-11-2-0-1-1-to-grid-infrastructure-rdbms-2/***************************************************https://nehakohlidba.wordpress.com/2015/01/18/database-upgrade-11-2-0-1-to-11-2-0-4-on-sap-using-mopatch-on-windows/***************************************************https://sadanandhudge.wordpress.com/2015/11/11/database-upgrade-from-11-2-0-1-to-11-2-0-4-on-linux-64bit/***************************************************http://www.dba-oracle.com/t_goldengate_upgrade_to_oracle12c.htm***************************************************http://dbaoracletips.blogspot.in/2014/02/owb-component-not-upgraded-to-11204.html***************************************************https://oracle-base.com/articles/11g/data-guard-setup-using-broker-11gr2***************************************************https://sachinichake.wordpress.com/2013/05/10/frequently-asked-questions/***************************************************http://expertoracle.com/2014/03/05/rman-recovery-scenarios-related-to-database/***************************************************http://www.dbas-oracle.com/2013/05/10-steps-to-analyze-awr-report-in-oracle.html***************************************************http://dbaquest.blogspot.in/2014/02/rac-11gr2-clusterware-startup-sequence.html***************************************************http://karandba.blogspot.in/2014/09/12c-sql-plan-management-spm.html***************************************************https://mewithoracle.wordpress.com/2012/05/02/recovering-through-an-added-datafile/***************************************************https://orainternals.wordpress.com/tag/ohasd-startup/****************************************************http://www.oraclebuffer.com/goldengate/understanding-oracle-goldengate-architecture/****************************************************https://dbastar.wordpress.com/2015/10/29/applying-psu-oct-2015-patch-11-2-0-4-8-to-a-two-node-rac/****************************************************https://docs.oracle.com/cd/B16240_01/doc/em.102/e15294/rac.htm****************************************************http://anotherdatabaseblog.blogspot.in/2011/10/crerating-ocm-response-file-for-gi-home.html****************************************************https://dbdwell.wordpress.com/category/rac/***************************************************https://aprakash.wordpress.com/2012/01/19/moving-aud-table-to-another-tablespace-in-11gr2/****************************************************https://hoopercharles.wordpress.com/2009/12/01/sql-plan_hash_value-changes-for-the-same-sql-statement/****************************************************https://web.stanford.edu/dept/itss/docs/oracle/10gR2/backup.102/b14191/rcmtspit001.htm****************************************************https://stackoverflow.com/questions/16011976/hash-value-for-sql-statement****************************************************https://oracle-dba-help.blogspot.in/2017/04/oracle-asm-interview-questions.html?m=1****************************************************http://oracle-dba-help.blogspot.in/search/label/Frequently%20Asked****************************************************https://blogshavail.wordpress.com/2012/03/03/remove-previous-gicrsasm-home-after-upgrade/****************************************************https://community.oracle.com/docs/DOC-1012784****************************************************http://enterprise-manager.blogspot.in/2011/04/favourite-questions-and-answers-from-em.html****************************************************http://blog.oracle48.nl/oracle-database-undo-space-explained/****************************************************http://vetriveldba.blogspot.in/2017/03/how-to-calculate-network-bandwidth-for.html*****************************************************http://searchoracle.techtarget.com/answer/26-performance-tuning-questions-and-solutions-1-10*****************************************************http://dba-expert.blogspot.in/2012/02/cross-platform-migration-using-rman.html******************************************************https://oracleracdba1.wordpress.com/2014/07/14/how-to-clone-oracle-binaries/******************************************************https://oracleracdba1.wordpress.com/category/oracle-rac/asm/******************************************************http://www.dba-oracle.com/t_data_pump_disable_archive_logging.htm******************************************************http://subudba.blogspot.in/search/label/Performance%20Tunning***********************************************************http://oukc.oracle.com/static09/opn/core09/oracle9i_database/89067/062410_89067/062410_89067_demo.html***********************************************************http://www.oracle-scripts.net/***********************************************************https://samadhandba.wordpress.com/2011/03/07/reducing-datafile-size-to-recover-free-space-%E2%80%93-oracle-database-10g/***********************************************************https://docs.oracle.com/cd/B19306_01/server.102/b14237/dynviews_1019.htm#REFRN30170***********************************************************https://alexzeng.wordpress.com/2012/09/25/valuate-oracle-awr-automatic-workload-repository/***********************************************************https://www.tutorialspoint.com/unix/unix-regular-expressions.htm***********************************************************https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=542863524161349&parent=DOCUMENT&sourceId=1366610.1&id=112248.1&_afrWindowMode=0&_adf.ctrl-state=jnzbip2ie_4 -- resetlogs***********************************************************http://dillidba.blogspot.in/2016/06/upgrade-oracle-11g-r2-11204-database-to.html --upgrade***********************************************************http://oracledbabhuvan.blogspot.in/2011/05/recreating-oracle-inventory-in-10g11g.html --recreate oracleinventory***********************************************************http://dnccfg.blogspot.in/ --Add node into RAC***********************************************************;Network & Infrastructure
DNS & Hosting
SSL/TLS Certificate
Technology Stack
Content Management Systems
Build Tools
Server Technologies
Services & Integrations
Analytics & Tracking
Advertising & Marketing
E-commerce Platforms
CDN & Media Providers
Media Providers
Dynamic Analysis & Security
Dynamic JavaScript Analysis
Security Headers
Server Headers
GSE
Resource Analysis
External Resource Hosts
apis.google.com
blogger.googleusercontent.com
manoj-dba.blogspot.com
resources.blogblog.com
www.blogger.com
UI Frameworks & Libraries
Social Media Integrations
Analysis Complete
Analyzed manoj-dba.blogspot.com with 3 technologies detected across 8 categories
Analysis completed in 1754 ms • 2026-03-23 07:44:33 UTC