Random Posts
Blog Archive
ORACLE DBA
Search This Blog
Blog Archive
Thirupal Boreddy. Powered by Blogger.
My Blog List
Followers
Lorem 1
Technology
Circle Gallery
‹
›
Shooting
Racing
News
Lorem 4
STOP SEQUENCE
COMMAND DESCRIPTION ------------------------------------------------------------------------------------------ srvctl stop database -d ORCL STOP DATABASE srvctl stop instance -d ORCL -i ORCL1 STOP first INSTANCE (skip it if running 'stop database' as that will stop both instances) srvctl stop instance -d ORCL -i ORCL2 STOP second INSTANCE (skip it if running 'stop database' as that will stop both instances) srvctl stop asm -n NODE1 STOP ASM INSTANCES on NODE 1 (In 11G , we have OCR on ASM so we cannot stop ASM, but if you have OCR in NON-ASM you should stop it) srvctl stop asm -n NODE2 STOP ASM INSTANCES on NODE 2 (In 11G , we have OCR on ASM so we cannot stop ASM, but if you have OCR in NON-ASM you should stop it) srvctl stop nodeapps -n NODE1 STOP NODEAPPS on NODE 1 srvctl stop nodeapps -n NODE2 STOP NODEAPPS on NODE 2 /etc/init.d/init.crs stop STOP CRS PROCESSES (AS ROOT USER)
START SEQUENCE
COMMAND DESCRIPTION ------------------------------------------------------------------------------------------- /etc/init.d/init.crs start START CRS PROCESS (AS ROOT USER) srvctl start asm -n NODE1 START ASM INSTANCE on node 1 srvctl start asm -n NODE2 START ASM INSTANCE on node 2 srvctl start database -d ORCL START DATABASE srvctl start instance -d ORCL -i ORCL1 START first INSTANCE (skip it if running 'start database' as that will start both instances) srvctl start instance -d ORCL -i ORCL2 START second INSTANCE (skip it if running 'start database', as taht will start both instances) srvctl start nodeapps -n NODE1 START NODEAPPS on NODE1 srvctl start nodeapps -n NODE2 START NODEAPPS ON NODE2
OTHER USEFUL COMMANDS
COMMAND DESCRIPTION --------------------------------------------------------------------- crsctl status resource -t Clusterware Resource Status Check srvctl status database -d ORCL STATUS OF DATABASE srvctl stop listener -l LISTENER_NAME STOP A LISTENER srvctl start listener -l LISTENER_NAME START A LISTENER crsctl stop has stop all the clusterware services/ resources on specific node (including DB and listener) (run as root) crsctl start has start all the clusterware services/ resources on specific node (including DB and listener) (run as root) crsctl stop cluster -all to stop csr services on all nodes of clusterware (run as root) crsctl start cluster -all to start crs services on all nodes of clusterware (run as root) crsctl check has to check if ohasd is running/ stopped (run as root) crsctl enable has enable Oracle High Availability Services autostart (run as root) crsctl disable has disable Oracle High Availability Services autostart (run as root) crsctl config has check if Oracle High Availability Services autostart is enabled/ disabled (run as root) srvctl status nodeapps to check the status of services on all nodes crsctl stop crs stop all the clusterware services/ resources ON THAT NODE! (run as root) crsctl start crs start all the clusterware services/ resources ON THAT NODE! (run as root) cluvfy comp scan -verbose Verifying scan status scan_listener srvctl config scan_listener Verifying scan port srvctl relocate scan -i 1 -n NODE1 Relocate scan listener 1 to the mentioned node
RAC Commands
http://www.oracleracexpert.com/2013/04/oracle-rman-backup-fails-with-ora-01031.html
RMAN>
RMAN> connect target *
RMAN-00571: ============================================
RMAN-00569: ======== ERROR MESSAGE STACK FOLLOWS ============
RMAN-00571: ============================================
ORA-01031: insufficient privileges
grant sysdba to <user>
Query v$pwfile_users to see the list of users who have been granted SYSDBA and SYSOPER privilege as derived from password file
http://www.pythian.com/blog/duplicate-from-active-database-using-rman-step-by-step/
http://oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2.php#active_database_duplication
In active database duplication, RMAN connects as TARGET to the source database instance and as AUXILIARY to the auxiliary instance. RMAN copies the live source database over the network to the auxiliary instance, thereby creating the duplicate database. No backups of the source database are required.
1)Start the db in nomount ON TARGET SERVER
2)Run the following commands from source
$ cat run_duplicate_db.sh
rman cmdfile=/rama/local/oracle/bin/dup_target_db02.rman log=/rama/local/oracle/bin/dup_target_db01.log
$ cat /rama/local/oracle/bin/dup_target_db02.rman
CONNECT TARGET sys/pwd@source_db
CONNECT AUXILIARY SYS/pwd@target_db
run {
ALLOCATE CHANNEL l1 TYPE DISK;
ALLOCATE CHANNEL l2 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL a1 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL a2 TYPE DISK;
DUPLICATE TARGET DATABASE TO target_db FROM ACTIVE DATABASE
SPFILE
parameter_value_convert 'source_db','target_db'
set control_files =
'/rama/local/oracle/database/target_db/cntl/cntl_01.ctl','/rama/local/oracle/database/target_db/cntl/cntl_02.ctl','/rama/local/oracle/database/target_db/cntl/cntl_03.ctl'
set db_file_name_convert='/rama/local/oracle/database/source_db','/rama/local/oracle/database/target_db'
set log_file_name_convert='/rama/local/oracle/database/source_db','/rama/local/oracle/database/target_db'
set db_recovery_file_dest='/rama/local/oracle/flashback'
set db_unique_name='target_db'
set instance_name='target_db'
set log_archive_format='target_db%t_%s_%r.arc'
set log_archive_dest_state_1='enable'
set remote_login_passwordfile='exclusive'
set service_names='target_db'
NOFILENAMECHECK;
}
http://oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2.php#active_database_duplication
In active database duplication, RMAN connects as TARGET to the source database instance and as AUXILIARY to the auxiliary instance. RMAN copies the live source database over the network to the auxiliary instance, thereby creating the duplicate database. No backups of the source database are required.
1)Start the db in nomount ON TARGET SERVER
2)Run the following commands from source
$ cat run_duplicate_db.sh
rman cmdfile=/rama/local/oracle/bin/dup_target_db02.rman log=/rama/local/oracle/bin/dup_target_db01.log
$ cat /rama/local/oracle/bin/dup_target_db02.rman
CONNECT TARGET sys/pwd@source_db
CONNECT AUXILIARY SYS/pwd@target_db
run {
ALLOCATE CHANNEL l1 TYPE DISK;
ALLOCATE CHANNEL l2 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL a1 TYPE DISK;
ALLOCATE AUXILIARY CHANNEL a2 TYPE DISK;
DUPLICATE TARGET DATABASE TO target_db FROM ACTIVE DATABASE
SPFILE
parameter_value_convert 'source_db','target_db'
set control_files =
'/rama/local/oracle/database/target_db/cntl/cntl_01.ctl','/rama/local/oracle/database/target_db/cntl/cntl_02.ctl','/rama/local/oracle/database/target_db/cntl/cntl_03.ctl'
set db_file_name_convert='/rama/local/oracle/database/source_db','/rama/local/oracle/database/target_db'
set log_file_name_convert='/rama/local/oracle/database/source_db','/rama/local/oracle/database/target_db'
set db_recovery_file_dest='/rama/local/oracle/flashback'
set db_unique_name='target_db'
set instance_name='target_db'
set log_archive_format='target_db%t_%s_%r.arc'
set log_archive_dest_state_1='enable'
set remote_login_passwordfile='exclusive'
set service_names='target_db'
NOFILENAMECHECK;
}
RMAN Duplication Scenarios
Duplicate db creation
for DBNAME in `ps -ef|grep pmon|grep -v grep|grep -v ASM|awk '{print $9}'|cut -d "_" -f3`
do
. /usr/local/oracle/bin/my.env $DBNAME
sqlplus -s /nolog <<EOF >> /tmp/db_status.log
connect / as sysdba
set pause off
set heading on
set echo on
set feedback on
set pause off
@/tmp/db_status.sql
EOF
done
FOR LOOP
Subscribe to:
Comments (Atom)
QUERY FOR CPU USAGE
select a.target_name as HOST, to_char(a.rollup_timestamp,' dd-Mon-yy::hh24:mi') as "DAY-TIME", sum(c.cpu_count) as ...

