RMAN REstore without Controlfile/Catalog

Posted on July 28th, 2010 by Balraj Singh Chahal  |  2 Comments »

Assumptions

1) There is no controlfile available
2) We have the DBID of the database
3) Database has been completely lost
4) We either have the Catalog OR the Logfile of the RMAN backup taken last time

Procedure To Restore

A) if we have the logfile of the backups , get the Media Handle of the controlfile from the logfile

Getting the Media Handle from the Backup Logfile

Recovery Manager: Release 11.2.0.1.0 – Production on Wed Jul 28 13:20:44 2010

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: itskills (DBID=1314616062)
connected to recovery catalog database

RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10>
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
allocated channel: t1
channel t1: SID=3 instance=itskills1 device type=SBT_TAPE
channel t1: Veritas NetBackup for Oracle – Release 6.5 (2010011113)

sent command to channel: t1

Starting backup at 28-JUL-10
channel t1: input backup set: count=178, stamp=725540188, piece=1
channel t1: starting piece 1 at 28-JUL-10
channel t1: backup piece +DG_RECOVERY/itskills/backupset/2010_07_28/nnndf0_tag20100728t105627_0.333.725540189
piece handle=5nljtotf_1_1comment=API Version 2.0,MMS Version 5.0.0.0
channel t1: finished piece 1 at 28-JUL-10
channel t1: backup piece complete, elapsed time: 00:01:21
channel t1: input backup set: count=179, stamp=725540213, piece=1
channel t1: starting piece 1 at 28-JUL-10
channel t1: backup piece +DG_RECOVERY/itskills/backupset/2010_07_28/ncsnf0_tag20100728t105627_0.324.725540215

1) Open a RMAN session connected to NOMOUNTED database
2) Set up the DBID in RMAN session

RMAN> set dbid 1314616062
connected to target database: itskills (DBID=1314616062)

3) Restore the Controfile as follows

RMAN> run
{
allocate channel t1 type ‘SBT_TAPE’;
send ‘NB_ORA_POLICY=itskills_ora, NB_ORA_SERV=backupdev.itskills.ca’;
restore controlfile from ’5nljtotf_1_1′
restore database;
release channel t1;
}

4) Mount the database

RMAN> alter database mount;

database mounted

5) Restore the Database

RMAN> run
2> {
3> allocate channel t1 type ‘SBT_TAPE’;
4> send ‘NB_ORA_POLICY=otskills_ora, NB_ORA_SERV=backupdev.itskills.ca’;
5>
6> restore database;
7> release channel t1;
8> }

allocated channel: t1
channel t1: SID=93 instance=itskills1 device type=SBT_TAPE
channel t1: Veritas NetBackup for Oracle – Release 6.5 (2010011113)

sent command to channel: t1

Starting restore at 28-JUL-10
Starting implicit crosscheck backup at 28-JUL-10
Crosschecked 25 objects
Finished implicit crosscheck backup at 28-JUL-10

Starting implicit crosscheck copy at 28-JUL-10
Finished implicit crosscheck copy at 28-JUL-10

searching for all files in the recovery area
cataloging files…
no files cataloged

channel t1: starting datafile backup set restore
channel t1: specifying datafile(s) to restore from backup set
channel t1: restoring datafile 00001 to +DG_DATA/itskills/datafile/system.621.724861111
channel t1: restoring datafile 00002 to +DG_DATA/itskills/datafile/sysaux.1472.724861113
channel t1: restoring datafile 00003 to +DG_DATA/itskills/datafile/undotbs.590.724861113
channel t1: restoring datafile 00005 to +DG_DATA/itskills/datafile/undotbs1.592.724861113
channel t1: restoring datafile 00006 to +DG_DATA/itskills/datafile/undotbs2.594.724861113
channel t1: reading from backup piece 5iljtnas_1_2

Shell Script to Backup the Oracle Database – RMAN

Posted on July 23rd, 2010 by Balraj Singh Chahal  |  No Comments »

    Shell Script to backup database using RMAN

#!/bin/sh
CUSER=`id |cut -d”(” -f2 | cut -d “)” -f1`
RMAN_LOG_FILE=${0}.out

echo >> $RMAN_LOG_FILE
chmod 666 $RMAN_LOG_FILE

echo Script $0 >> $RMAN_LOG_FILE
echo ==== started on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE

ORACLE_HOME=/opt/oracle/product/11.2.0
export ORACLE_HOME

ORACLE_SID=ITSKILLS1
export ORACLE_SID

ORACLE_USER=oracle

TARGET_CONNECT_STR=sys/manager

RMAN=$ORACLE_HOME/bin/rman

echo >> $RMAN_LOG_FILE
echo “RMAN: $RMAN” >> $RMAN_LOG_FILE
echo “ORACLE_SID: $ORACLE_SID” >> $RMAN_LOG_FILE
echo “ORACLE_USER: $ORACLE_USER” >> $RMAN_LOG_FILE
echo “ORACLE_HOME: $ORACLE_HOME” >> $RMAN_LOG_FILE

echo >> $RMAN_LOG_FILE
echo “NB_ORA_FULL: $NB_ORA_FULL” >> $RMAN_LOG_FILE
echo “NB_ORA_INCR: $NB_ORA_INCR” >> $RMAN_LOG_FILE
echo “NB_ORA_CINC: $NB_ORA_CINC” >> $RMAN_LOG_FILE
echo “NB_ORA_SERV: $NB_ORA_SERV” >> $RMAN_LOG_FILE
echo “NB_ORA_POLICY: $NB_ORA_POLICY” >> $RMAN_LOG_FILE

echo >> $RMAN_LOG_FILE

if [ "$NB_ORA_FULL" = "1" ]
then
echo “Full backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=0″

elif [ "$NB_ORA_INCR" = "1" ]
then
echo “Differential incremental backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=1″

elif [ "$NB_ORA_CINC" = "1" ]
then
echo “Cumulative incremental backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=1 CUMULATIVE”

elif [ "$BACKUP_TYPE" = "" ]
then
echo “Default – Full backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=0″
fi

CMD_STR=”
#!/bin/sh
CUSER=`id |cut -d”(” -f2 | cut -d “)” -f1`
RMAN_LOG_FILE=${0}.out

echo >> $RMAN_LOG_FILE
chmod 666 $RMAN_LOG_FILE

echo Script $0 >> $RMAN_LOG_FILE
echo ==== started on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE

ORACLE_HOME=/opt/oracle/product/11.2.0
export ORACLE_HOME

ORACLE_SID=ITSKILLS
export ORACLE_SID

ORACLE_USER=oracle

TARGET_CONNECT_STR=sys/manager

RMAN=$ORACLE_HOME/bin/rman

echo >> $RMAN_LOG_FILE
echo “RMAN: $RMAN” >> $RMAN_LOG_FILE
echo “ORACLE_SID: $ORACLE_SID” >> $RMAN_LOG_FILE
echo “ORACLE_USER: $ORACLE_USER” >> $RMAN_LOG_FILE
echo “ORACLE_HOME: $ORACLE_HOME” >> $RMAN_LOG_FILE

echo >> $RMAN_LOG_FILE
echo “NB_ORA_FULL: $NB_ORA_FULL” >> $RMAN_LOG_FILE
echo “NB_ORA_INCR: $NB_ORA_INCR” >> $RMAN_LOG_FILE
echo “NB_ORA_CINC: $NB_ORA_CINC” >> $RMAN_LOG_FILE
echo “NB_ORA_SERV: $NB_ORA_SERV” >> $RMAN_LOG_FILE
echo “NB_ORA_POLICY: $NB_ORA_POLICY” >> $RMAN_LOG_FILE

echo >> $RMAN_LOG_FILE

if [ "$NB_ORA_FULL" = "1" ]
then
echo “Full backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=0″

elif [ "$NB_ORA_INCR" = "1" ]
then
echo “Differential incremental backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=1″

elif [ "$NB_ORA_CINC" = "1" ]
then
echo “Cumulative incremental backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=1 CUMULATIVE”

elif [ "$BACKUP_TYPE" = "" ]
then
echo “Default – Full backup requested” >> $RMAN_LOG_FILE
BACKUP_TYPE=”INCREMENTAL LEVEL=0″
fi

CMD_STR=”
ORACLE_HOME=$ORACLE_HOME
export ORACLE_HOME
ORACLE_SID=$ORACLE_SID
export ORACLE_SID
TAG=`date +%Y%m%d%H%M%S`
export TAG
$RMAN target / nocatalog msglog $RMAN_LOG_FILE append << EOF
RUN {
allocate channel t1 type 'SBT_TAPE';
allocate channel t2 type 'SBT_TAPE';
allocate channel t3 type 'SBT_TAPE';
send 'NB_ORA_POLICY=ITSKILLS, NB_ORA_CLIENT=ITSKILLS, NB_ORA_SERV=ITSKILLS';
backup backupset completed after 'SYSDATE-1' tag='Backup_to_TAPE_${TAG}';
release channel t1;
release channel t2;
release channel t3;
}
EOF
"

# Initiate the command string

if [ "$CUSER" = "root" ]
then
su - $ORACLE_USER -c "$CMD_STR" >> $RMAN_LOG_FILE
RSTAT=$?
else
/usr/bin/sh -c “$CMD_STR” >> $RMAN_LOG_FILE
RSTAT=$?
fi

# —————————————————————————
# Log the completion of this script.
# —————————————————————————

if [ "$RSTAT" = "0" ]
then
LOGMSG=”ended successfully”
else
LOGMSG=”ended in error”
fi

echo >> $RMAN_LOG_FILE
echo Script $0 >> $RMAN_LOG_FILE
echo ==== $LOGMSG on `date` ==== >> $RMAN_LOG_FILE
echo >> $RMAN_LOG_FILE

exit $RSTAT

Balraj Singh

RMAN Backup Shell Script

Posted on July 8th, 2010 by Balraj Singh Chahal  |  No Comments »

Simple Shell script for RMAN backups of the database

export TAG=`date +%Y%m%d%H%M%S`
export ORACLE_SID=ABCD
rman target / nocatalog << !
run
{
allocate channel t1 type disk format ‘+DG_RECOVERY’;
backup database tag=’Backup_to_ASM_${TAG}’;
release channel t1;
}
!

Enabling Tracing for RMAN Sessions

Posted on July 5th, 2010 by Balraj Singh Chahal  |  No Comments »

RMAN backups failing ? No clue with error Messages ?

You may want to enable the trace/debugging to get more info on the reasons for failure. Here is how we go abt it

The following also tells how we direct the backups to be restored at a different location.

Also this describes how we can backup an exisiting backup set

$ rman target / catalog rman/rman@catalog.world trace=’/tmp/rman_debug.trc’ log=’/tmp/rman.log’
RMAN> set echo on;
RMAN> run {
debug on;
allocate channel t1 type disk ;
set newname for datafile 1 to ‘+DG_RECOVERY’;
set newname for datafile 2 to ‘+DG_RECOVERY’;
set newname for datafile 3 to ‘+DG_RECOVERY’;
set newname for datafile 4 to ‘+DG_RECOVERY’;
set newname for datafile 5 to ‘+DG_RECOVERY’;
set newname for datafile 6 to ‘+DG_RECOVERY’;
restore database;
release channel t1;
debug off ;
}

RMAN> backup backupset completed after ‘sysdate-1′ format ‘d:\rman_backup\bs_bk_%U’;

Rename dbf file with awk and sed

Posted on June 7th, 2010 by John Sing-Cheong Chen  |  No Comments »

Database: Oracle any version

It takes lots of typing to come out with data file rename command, or rename a directory in controlfile creation script created by “alter database backup controlfile to trace”

Following are 2 tips

Tip 1: Rename dbf file based on dba_data_files output

Extract list of file from database

  1. set pagesize 0 feedback off
  2. spool ren_dbf.lst
  3. select file_name from dba_data_files;
  4. spool off

Assume I want to rename dir from “/u01/oracle/oradata/ICCS/” to “/d02/oradata/iccsdev/”

awk ‘{printf “Alter Database Rename File ‘\”” $0 “‘\” to ‘\””; sub(“u01″, “d02″) ; sub (“ICCS”, “iccsdev”); print $0 “‘\”;”}’  ren_dbf.lst > ren_dbf.sql

Tip 2: Replace file path inside trace file created by “…backup to trace” command

  1. Create trace file using “alter database backup controlfile to trace;”
  2. Look into udump directory, which it is pointed by “show parameter udump” from SQL*Plus
  3. Use UNIX command to replace the file’s path. In following example, it replace directory name u01 to d02

sed “s/u01/d02/” cr_ctrl.sql > cr_ctrl1.sql

If wants to replace ORACLE_SID (as part of file name) ICCS with iccsdev in addition to above, use 2 sed commands:

sed “s/u01/d02/” cr_ctrl.sql | sed “s/ICCS/iccsdev/” > cr_ctrl2.sql

Active Dataguard – 11g

Posted on June 3rd, 2010 by Balraj Singh Chahal  |  No Comments »

Active dataguard is nice feature introduced in 11g – probably waited for years. I tried to run through this feature (enabling/disabling) the ACTIVE STANDBY and would like to share the commands used for the same as below.

Active DataGuard – In a line Active Dataguard is a new feature where Standby DB can be queried while the REDOs are also applied from Primary Database.

FYI – There is an extra license required in order to use this feature.

CONFIGURATION When NO ACTIVE DATAGUARD IS Implemented Yet
===================================================

At this stage the DATAGUARD configuration consists of 2 databases

STTEST_dbserver – Primary database
STTEST_Standby – Physical standby database

DGMGRL> show configuration;

Configuration – DG_Test

Protection Mode: MaxPerformance
Databases:
STTEST_dbserver – Primary database
STTEST_Standby – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL>

Now we Enable ACTIVE DATAGUARD on : STTEST_Standby
============================================

1) Disable the REDO APPLY on Standby

DGMGRL> edit database ‘STTEST_Standby’ set state=apply-off;
Succeeded.
DGMGRL> show configuration;

Configuration – DG_Test

Protection Mode: MaxPerformance
Databases:
STTEST_dbserver – Primary database
STTEST_Standby – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

DGMGRL> show database “STTEST_Standby”;

Database – STTEST_Standby

Role: PHYSICAL STANDBY
Intended State: APPLY-OFF
Transport Lag: 0 seconds
Apply Lag: 4 minutes 17 seconds
Real Time Query: OFF
Instance(s):
STTEST

Database Status:
SUCCESS

2) Shutdown Standby

SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL>

3) Open the Standby database

SQL> startup;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size 2217872 bytes
Variable Size 641730672 bytes
Database Buffers 419430400 bytes
Redo Buffers 5558272 bytes
Database mounted.
Database opened.

4) Turn on the REDO APPLICATION to Standby

DDGMGRL> edit database “STTEST_Standby” set state=apply-on;
Succeeded.
DGMGRL> show database “STTEST_Standby”;

Database – STTEST_Standby

Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: ON
Instance(s):
STTEST

Database Status:
SUCCESS

TEST THE ACTIVE STANDBY DATABASE NOW
====================================

1) Create a Table on the Primary Database and insert some ROWS.

SQL> conn / as sysdba
Connected.
SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
93

SQL> create table activetest(A number);

Table created.

SQL> insert into activetest values (2);

1 row created.

SQL> /

1 row created.

SQL> commit;

Commit complete.

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
95

2) Check the Sequence and Table on the Active Standby Database

SQL> select count(*) from activetest;

COUNT(*)
———-
2

SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
95

    ===> So REDOs propagated and the database is READABLE as well (As seen above)


Disabling the ACTIVE DATAGUARD

=========================

1) Disable the APPLICATION REDO

DGMGRL> edit database “STTEST_Standby” set state=apply-off;
Succeeded.
DGMGRL> show database “STTEST_Standby”;

Database – STTEST_Standby

Role: PHYSICAL STANDBY
Intended State: APPLY-OFF
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
STTEST

Database Status:
SUCCESS

2) Shutdown the Active Standby Database

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>

3) Mount the Standby Database

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size 2217872 bytes
Variable Size 641730672 bytes
Database Buffers 419430400 bytes
Redo Buffers 5558272 bytes
SQL> alter database mount standby database;

Database altered.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

Database altered.

4) Reintiate the REDO Application

DGMGRL> edit database “STTEST_Standby” set state=apply-on;
Succeeded.
DGMGRL> show database “STTEST_Standby”;

Database – STTEST_Standby

Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds
Apply Lag: 0 seconds
Real Time Query: OFF
Instance(s):
STTEST

Database Status:
SUCCESS

DGMGRL>

5) Confirm that the REDOs are now being applied

On Primary
==========

SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
98

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
100

On Standby
==========

SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
98

SQL> select max(sequence#) from v$log;

MAX(SEQUENCE#)
————–
100

SQL> select count(*) from activetest;
select count(*) from activetest
*
ERROR at line 1:
ORA-01219: database not open: queries allowed on fixed tables/views only

SQL>

So ACTIVE DATABASE IS NO LONGER ACTIVE

Have fun with this lovely new feature

Balraj Singh Chahal
ITSKILLS.CA

needed to set up a new service for my three nodes Oracle RAC production environment.

Posted on May 31st, 2010 by Balraj Singh Chahal  |  No Comments »

needed to set up a new service for my three nodes Oracle RAC production environment.
I decided to use dbca because it’s easier compared with srvctl command line.
Indeed when you use DBCA to create a service you do not need to add the corresponding TNS entry in your tnsnames.ora on the cluster nodes: DBCA does it all for you in the background.
Of course you can use SRVCTL to create a service, but you also need to manually add the TNS entry: moreover when you use SRVCTL, after you’ve created the new service you need to start it with a separate command, while DBCA starts it when you click FINISH button.
So let’s start logging as oracle user from one of your nodes, and type
dbca

It first shows the Welcome window where you need to select your type of database: Oracle Real Application Cluster database or Oracle single instance database.

Next you need to choose the operation to be performed. Choose Services Management and click NEXT button.

At the step 2 select your database. In my case the screen shows my only BILLING database

The step 3 shows the current services available for the database chosen. In this screen you can add, remove or modify services. Today we want to add a new service so click the ADD button.

After clicking the ADD button you can choose a name for next service: in my case I called it SIM_TAF. Press OK button after you enter your service name.

Now configure your option for the new service. I choose it should have only a preferred instance where to run (BILLING3) and two available instances to switch over in case of problems (BILLING1 and BILLING2). Choose also your TAF (Transparent Application Failover) policy:
transparent application failover is a client-side feature that allows for clients to reconnect to surviving databases in the event of a failure of a database instance. Notifications are used by the server to trigger TAF callbacks on the client-side. Your options could be: Basic, in which the application connects to a backup node only after the primary connection fails. This approach has low overhead, but the end user experiences a delay while the new connection is created, or Pre-Connect, where the application simultaneously connects to both a primary and a backup node. This offers faster failover, because a pre-spawned connection is ready to use. But the extra connection adds everyday overhead by duplicating connections. For my environment Basic TAF policy was good. Click FINISH.

A summary screen will appear. Click OK

The configuration of the new service will start

Click NO if you don’t want to perform other operation.

That’s all.

Etichette: Oracle Real Application Clusters on 10gR2

11gR2 RAC installation on 64 bit Linux step by step and new features

Posted on May 29th, 2010 by Balraj Singh Chahal  |  No Comments »

Today i completed a 11g Release 2 real application clusters installation on 64 bit Oracle Enterprise Linux 4. The installation process is very similar to the 10g and 11gr1 installations, but much simpler. This was a two node cluster. There are some new concepts that are introduced in 11gR2 real application clusters. Below are some of my notes on 11gr2 new features for Rac and detailed steps that i followed to complete the installation.

Some new concepts in 11gR2 Rac

Oracle clusterware and ASM now are installed into the Same Oracle Home, and is now called the grid infrastructure install.

Raw devices are no longer supported for use for anything (Read oracle cluster registry, voting disk, asm disks), for new installs.

OCR and Voting disk can now be stored in ASM, or a certified cluster file system.

The redundancy level of your ASM diskgroup (That you choose to place voting disk on) determines the number of voting disks you can have.
You can place

Only One voting disk on an ASM diskgroup configured as external redundancy
Only Three voting disks on an ASM diskgroup configured as normal redundancy
Only Five voting disks on an ASM diskgroup configured as high redundancy

The contents of the voting disks are automatically backed up into the OCR

ACFS (Asm cluster file system) is only supported on Oracle Enterprise Linux 5 (And RHEL5), not on OEL4.

There is a new service called cluster time synchronization service that can keep the clocks on all the servers in the cluster synchronized (In case you dont have network time protocol (ntp) configured)

Single Client Access Name (SCAN), is a hostname in the DNS server that will resolve to 3 (or at least one) ip addresses in your public network. This hostname is to be used by client applications to connect to the database (As opposed to the vip hostnames you were using in 10g and 11gr1). SCAN provides location independence to the client connections connecting to the database. SCAN makes node additions and removals transparent to the client application (meaning you dont have to edit your tnsnames.ora entries every time you add or remove a node from the cluster).

Oracle Grid Naming Service (GNS), provides a mechanism to make the allocation and removal of VIP addresses a dynamic process (Using dynamic Ip addresses).

Intelligent Platform Management Interface (IPMI) integration, provides a new mechanism to fence server’s in the cluster, when the server is not responding.

The installer can now check the O/S requirements, report on the requirements that are not met, and give you fixup scripts to fix some of them (like setting kernel parameters).

The installer can also help you setup SSH between the cluster nodes.

There is a new deinstall utility that cleans up a existing or failed install.

And the list goes on an on.

I have broken up the installation process into 3 distinct documents, which can be found below

Installing 11gr2 grid infrastructure

Installing 11gr2 Real Application Clusters

Creating the 11gr2 Clustered database

SQLs to get the information for a Schema !!

Posted on May 28th, 2010 by Balraj Singh Chahal  |  No Comments »

You are going to drop a schema but you want to keep some information (just incase the schema needs to be recreated) , use following scripts and run the SQLs retrieved when the user needs to be created again

SELECT DBMS_METADATA.GET_DDL(‘USER’, ‘ALG2MSO’) || ‘/’ DDL FROM dual;

SELECT DBMS_METADATA.GET_GRANTED_DDL(‘ROLE_GRANT’, ‘ALG2MSO’) || ‘;’ DDL from dual;

SELECT DBMS_METADATA.GET_GRANTED_DDL(‘SYSTEM_GRANT’, ‘ALG2MSO’) || ‘/’ DDL FROM dual;

SELECT DBMS_METADATA.GET_GRANTED_DDL(‘OBJECT_GRANT’, ‘ALG2MSO’) || ‘/’ DDL FROM dual;

Restoring the RMAN Backup on Different Server !!

Posted on May 27th, 2010 by Balraj Singh Chahal  |  No Comments »

Assumptions
============

1) You are cloning PROD to DEV with same SID Name
2) RMAN (Full Backups + Control File) is the method for backups on PROD
3) The Production and DEV run on same OS and RDBMS Versions

Steps to Restore the RMAN Backup on Different Server !!

Take the RMAN backup (full backup + Controlfile) on PROD and move to DEV on same filesystems as PRODUCTION
Make sure that we have all the file systems in same pattern on DEV as PROD (Directory Structures etc)
NOMOUNT the Database on DEV with same PFILE as of prod
Login to RMAN
RMAN> restore controlfile from ‘give the destination of the Controlfile of the backup from PROD’
Mount the database
Restore the Database
RMAN> Restore the database;
Recover the Database (Make sure the acrhive backups were coped over to DEV)
RMAN> Recover the database;
Open the database
SQL> Alter database open resetlogs;

The clone of the PROD is now ready on the DEV with same SID.

== Balraj Singh Chahal
ITSKILLS.CA