Monday, April 12, 2010

Create a Oracle Database Server Using RMAN backup from another Server

Create a Oracle Database Server Using RMAN backup from another Server


1) install Oracle server 10.2.0.3 without create startup database

------------------------------------------------------------------------------------------

2) Apply patch

Before you apply the patchset you have to check whether the Oracle Version is 32 bit or 64 bit Version, because
the patchsets are different.
For 32 Bit Version, Patch no is p6810189_10204_Win32_patchset
For 64 Bit Version, Patch no is p6810189_10204_MSWIN-x86-64.

1. Shut down the database:
SQL> SHUTDOWN IMMEDIATE.
Stop all the Oracle Related Services.
Ex:- Oracle Listener, Oracle DB Console,Oracle JobScheduler,
Distrubed Transaction Co-ordinator.
Run the Patch Setup.exe in the same Oracle Home.
For Example: If Existing Oracle is installed in c:\Oracle\product\10.2.0\db_1 then you
have to select the same path When you run the Setup.exe. After Successful installation
start the Listener & Db Console etc.,
Enter the following SQL*Plus commands:
SQL> SET ORACLE_SID=sns6
SQL> SQLPLUS/NOLOG
SQL> CONNECT SYS/LINUX@sns1011SRV AS SYSDBA
SQL> STARTUP UPGRADE
SQL> SPOOL patch.log
SQL> @ORACLE_BASE\ORACLE_HOME\rdbms\admin\catupgrd.sql
SQL> SPOOL OFF
Review the patch.log file for errors and inspect the list of components that is displayed at the end of
catupgrd.sql script.
This list provides the version and status of each SERVER component in the database.
If necessary, rerun the catupgrd.sql script after correcting any problems.


SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP

Run the utlrp.sql script to recompile all invalid PL/SQL packages now instead of when the packages are
accessed for the first time. This step is optional but recommended.

SQL> @ORACLE_BASE\ORACLE_HOME\rdbms\admin\utlrp.sql

------------------------------------------------------------------------------------------

3)

mkdir c:\oracle\product\10.2.0\admin\sns1011\adump
mkdir c:\oracle\product\10.2.0\admin\sns1011\bdump
mkdir c:\oracle\product\10.2.0\admin\sns1011\cdump
mkdir c:\oracle\product\10.2.0\admin\sns1011\dpdump
mkdir c:\oracle\product\10.2.0\admin\sns1011\pfile
mkdir c:\oracle\product\10.2.0\admin\sns1011\udump
mkdir c:\oracle\product\10.2.0\db_1\cfgtoollogs\dbca\sns1011
mkdir c:\oracle\product\10.2.0\db_1\database
mkdir c:\oracle\product\10.2.0\oradata
mkdir e:\snsd1011
mkdir e:\archive1011\sns1011

copy /y M:\backup\tnsnames.ora C:\oracle\product\10.2.0\client_1\network\ADMIN\
copy /y M:\backup\initsns6.ora C:\oracle\product\10.2.0\db_1\database\
copy /y M:\backup\SNCFSNS6.ORA C:\oracle\product\10.2.0\db_1\database\


------------------------------------------------------------------------------------------

4)

Step 1: Create Database Instance (SID)

C:\>set ORACLE_SID=sns6

Step 2: Establish the Database Administrator Authentication Method

c:\>oradim -delete -sid sns6 --if already exist, delete it

C:\>oradim -new -sid sns6 -SRVC OracleServicesns6 -intpwd linux -MAXUSERS 5 -STARTMODE auto -PFILE C:\oracle\product\10.2.0\db_1\database\initsns6.ora

----------not neccessary
C:\>oradim -new -sid sns6 -SYSPWD linux -STARTMODE auto -PFILE C:\oracle\product\10.2.0\db_1\database\initsns6.ora

C:\oracle\product\10.2.0\db_1\database\PWDsns6.ora created (orapwd FILE=PWDsns6.ora ENTRIES=5)
-------------


Step 3: Create the Initialization Parameter File or place the backup on C:\oracle\product\10.2.0\db_1\database

create initsns6.ora file(C:\oracle\product\10.2.0\db_1\database)

SQL> create spfile from pfile;

Step 4: Connect to the Instance

sqlplus /nolog

SQL> connect sys/linux@sns1011srv as sysdba

SQL>startup nomount pfile='C:\oracle\product\10.2.0\db_1\database\initsns6.ora';

Step 5: Create a Server Parameter File (Recommended)

CREATE SPFILE='C:\ORACLE\PRODUCT\10.2.0\db_1\database\spfilesns6.ora’ from

Pfile=’C:\ORACLE\PRODUCT\10.2.0\ADMIN\orcl\pfile\initsns6.ora’;

SHUTDOWN

Step 6

STARTUP NOMOUNT

Step 7: Create database using RMAN


C:\>SET ORACLE_SID=sns6
C:\>RMAN TARGET SYS@SNS1011SRV

c:\>RMAN>SHOW ALL;

RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'E:\archive1011\sns1011\F%';
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'E:\archive1011\sns1011\%F';
RMAN> BACKUP DATABASE FORMAT 'E:\archive1011\sns1011\F%';
RMAN> BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT 'E:\archive1011\sns1011\U%';

RMAN> RESTORE CONTROLFILE FROM 'E:\archieve1011\SNS1011\C-1560435174-20081003-00';
SQL> alter database MOUNT;


RMAN> list backup of database;
RMAN> CROSSCHECK backup of database;
RMAN> delete expired backup;

------not neccessary----------------------
RMAN> CROSSCHECK backup of controlfile;
RMAN> CROSSCHECK archivelog all;
RMAN> delete force obsolete;
RMAN> delete expired archivelog all;

-------------

RMAN> catalog backuppiece 'E:\archive1011\sns1011\0ULAP4RC_1_1';

RMAN> list backup of database;



RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
SQL> ALTER DATABASE OPEN RESETLOGS;
SQL> recover database using backup controlfile until cancel;

No comments:

Post a Comment

Followers