Select Menu

Ads

Random Posts

Powered By Blogger
Powered By Blogger

Blog Archive

Search This Blog

Thirupal Boreddy. Powered by Blogger.

My Blog List

Followers

Lorem 1

Technology

Circle Gallery

Shooting

Racing

News

Lorem 4

DAILY REFRESH

sqlplus / nolog <<EOM

CONNECT / AS SYSDBA

STARTUP MOUNT EXCLUSIVE RESTRICT;
DROP DATABASE;

STARTUP FORCE NOMOUNT PFILE=/PATH/PFILE';

RMAN auxilary / log=rmandb.log <<EOF

run
{
DUPLICATE TARGET DATABASE TO <DBNAME> UNTIL TIME 'SYSDATE-24'
BACKUP LOCATION '/XYZ/ABC';
}
EOF
REFRESH

sqlplus / nolog <<EOM

CONNECT / AS SYSDBA

STARTUP FORCE NOMOUNT
WHENEVER SQLERROE EXIT FAILURE
SET TIMING ON
EXIT
EOF

RMAN TARGET SYS/PASSWORD catalog rman/password@catdb
auxilary / log=rmandb.log <<EOF

run
{
set untiltime "to_date('31-JUL-15 22:00:00','DD-MON-YY HH24:MI:SSS')";DUPLICATE TARGET DATABASE TO <DBNAME>;'
}
EOF





STEPS TO RESTORE THE DB FROM BACKUP
====================================

1)Backups are located in /u01/tmp location

2)Start the db in nomount stage

startup nomount pfile='$ORACLE_HOME/dbs/initxyzdb.ora';

3) Restore the controlfile

4) rman> set dbid=123456;

5) rmna> restore controlfile from backup;

6) start the db in mount stage

7) catalog the files.

catalog start with '/u01/tmp';

8) restore th db

rman target / cmdfile= abc.rman log=/tmp/abc.log

run
{
set newname to data file 1 to '/u01/xyz_1.dbf';
set newname to data file 2 to '/u01/xyz_2.dbf';
--
--
restore database
switch datafile all;
}

9) Create the controlfile
10) Alter database open reset logs;
11) add the temp file
12)creat the spfile;
13)shutdown and start the db with spfile;


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 ...