Sie sind auf Seite 1von 5

Oracle Standby Database Creation

Request your filesystem layout for the new standby system according to the directory
structure and size of the directories on the primary system. Below is an example, but
your directory structure may vary significantly:
Customer
Server Name

Testco
Mount Point

Size

Volume Name

OUXS99TC

/oracle/SID
/oracle/SID/102_64
/oracle/SID/sapdata1
/oracle/SID/sapdata2
/oracle/SID/sapdata3
/oracle/SID/sapdata4
/oracle/SID/sapdata5
/oracle/SID/sapdata6
/oracle/SID/mirrlogA
/oracle/SID/mirrlogB
/oracle/SID/origlogA
/oracle/SID/origlogB
/oracle/SID/oraarch
/oracle/SID/sapreorg
/sapmnt/SID
/sapbackup/SID
/sapmnt/SID/global
/sapmnt/SID/profile
/usr/sap/SID

2GB
5GB
10GB
10GB
10GB
10GB
10GB
10GB
512MB
512MB
512MB
512MB
5GB
2GB
2GB
20GB
1GB
1GB
5GB

execdg
execdg
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
SID99db
execdg
execdg
execdg
execdg
execdg

Once the directory structure is in place, create the necessary directories for SAP as shown
below.

Logon to the primary and standby systems.


Copy User, Group, and Services information:
On primary execute: pg /etc/passwd
On standby execute: vi /etc/passwd
Copy lines (should be 2) containing <sid>adm and ora<sid> from the primary passwd file
to the standbys passwd file. Save your changes.
On primary execute: pg /etc/group
On standby execute: vi /etc/group
Copy lines (should be 3) containing sapsys, dba, and oper from the primary group file to
the standbys group file in not already there. Save your changes.
On primary execute: pg /etc/services
On standby execute: vi /etc/services
Copy sap service lines from the primary services file to the standbys services file. Save
your changes.
Hosts entries:
On primary execute: vi /.rhosts
On standby execute: vi /.rhosts
Add the standby server to the primary servers .rhosts file and the primary server to the
standby servers .rhosts file. Save your changes.
Copy <sid>adm:
On the standby make sure you are in the /home directory and execute the following
command: rcp pr primaryhostname:/home/<sid>adm . &
Note: The . is indicating to copy the folder to your current working directory and the
& is indicating to do this in the background. You can check the process by running the
following command: ps ef |grep rcp
Once the copy has completed change the permissions of the new folder by running the
following command. chown <sid>adm:sapsys <sid>adm
After this navigate to the /home/<sid>adm directory and change the name of the files
containing the primary servers name to reflect the standby servers name. To do this run
the following command: mv oldfilename newfilename
When all necessary file name changes are complete make sure you are still in the
/home/<sid>adm directory and run the command: chown <sid>adm:sapsys .* *

Copy /oracle/client:

If the client is not already installed on the standby server then cd to the /oracle directory
and run the following command:
rcp pr primaryhostname:/oracle/client . & When this is complete you will need to
change permissions of the /oracle/client directory of the standby system. First make sure
you are in /oracle of the standby system and run: chown R <sid>adm:sapsys client
Copy /oracle/<SID>/version:
If the oracle software has not yet been installed on the standby system then cd to the
/oracle/<SID> directory and run the following command: rcp pr
primaryhostname:/oracle/<SID>/version . &
Example: rcp pr oaxs00sb:/oracle/SBX/920_64 . &
When the copy has completed change the ownership of the /oracle/<SID> directory and
the /oracle/<SID>/version directory using the following commands:
From /oracle chown <sid>adm:sapsys <SID>
Example: chown sbxadm:sapsys SBX
From /oracle/<SID> chown R <sid>adm:sapsys version
Example: chown R sbxadm:sapsys 920_64
Verify tnsnames:
On the standby cd to /oracle/<SID>/version/network/admin and run the following
command:vi tnsnames.ora Verify that the proper hostname is listed in this file. Modify
as needed and save your changes.
Creating /usr/sap file system:
On the standby cd to /usr and run the following command: chown <sid>adm:sapsys
sap
On the standby cd to /usr/sap and run this command: mkdir <SID> tmp This will make
the directories <SID> and tmp in the /usr/sap directory.
On the standby cd to /usr/sap/<SID> and create the directories <DXX> and SYS where
<DXX> is the instance number of the primary system.
On the standby cd to /usr/sap/<SID>/<DXX> and create the directories log, work, data,
and sec.
On the standby cd to /usr/sap/<SID>/SYS and create the directories exe and src.
In the /usr/sap/<SID>/SYS directory, create the global and profile soft links using the
following commands: ln s /sapmnt/<SID>/global global and
ln s /sapmnt/<SID>/profile profile
On the standby cd to /usr/sap/<SID>/SYS/exe and create the directory opt.
In the /usr/sap/<SID>/SYS/exe directory, create the dbg and run soft links using the
following commands: ln s /sapmnt/<SID>/exe dbg and ln s dbg run

On the standby cd to /usr/sap/<SID> (Make sure you are in this directory!!!) and run
the following command: chown Rh <sid>adm:sapsys *
Copy exe:
On the standby cd to /sapmnt/<SID> and run the follwing command:
rcp pr primarysystem:/sapmnt/<SID>/exe . & When this is complete run this
command: chown R <sid>adm:sapsys exe
Run saproot.sh:
On the standby as the root user cd to /sapmnt/<SID>/exe and run the following
command: ./saproot.sh <SID> This script will change the ownership of the files in exe
according to SAPs requirements.
Backup the Primary Database:
Perform and online backup of the primary database with the brbackup tool.
Create a standby controlfile:
From the primary server as the orasid user, open sqlplus with the command:
sqlplus /nolog
Then issue the following command to create the controlfile:
SQL> connect /as sydba
SQL> alter database create standby controlfile as /sapbackup/SID/cntrlSIDsb.dbf;
Copy the Backup to the Standby System:
Copy the completed backup to the standby server by logging onto the standby server,
navigating to the directory you wish to copy the backup to (probably
/sapbackup/<SID> but it should be the same as the Primary), and issue the following
command:
rsh primarysystem "cd /sapbackup/<SID>;/usr/bin/tar cf - ." | /usr/bin/tar xvf
Alternately you can request that netbackup backup the /sapbackup file system and restore
it to the target system. Obviously time would be of greatest concern so whatever method
is chosen must be timely.
Restore the Standby Database:
On the standby system create all of the directories under /oracle/SID that exist on the
primary and do so as the orasid user. Once this is done issue the command: brrestore
b <backup_name>.and m full
Restore the Archive Logs:
On the standby system go to /sapbackup/SID/brarchive and if it contains archived log
files issue the following command to restore them to the archive directory so that they
can be applied: brrestore a ####-#### Where #### is representing the log
sequence numbers of the files you want to restore.

Recover the Database:


On the standby system as the orasid user, open sqlplus with the command:
sqlplus /nolog
Then issue the following commands to recover the logs:
SQL> connect /as sydba
SQL> startup mount
SQL> recover database until cancel using backup controlfile;
Only recover to the last Archive Log in the sequence of the restored archive logs
determined in the previous step. Once the last log is recovered enter CANCEL.
Then shutdown the database with shutdown immediate .
Update the Standby Servers Controlfile:
From the standby server as the orasid user, open the /oracle/SID/102_64/dbs/initSID.ora
file and make note of the location of the controlfiles. Copy the
/sapbackup/SID/cntrlSIDsb.dbf file to the locations of the current control files. Navigate
to each controlfile location and rename the original controlfiles to cntrlSID.dbf-old and
rename the cntrlSIDsb.dbf file to the name of the original files. Make sure that the orasid
user is the owner of the replacement controlfiles.
Start up the standby database:
On the standby system as the orasid user, open sqlplus with the command:
sqlplus /nolog
Then issue the following commands to recover the logs:
SQL> connect /as sydba
SQL> startup nomount
SQL> alter database mount standby database;
Copy and Modify the DR Scripts:
Copy the DR scripts from \\172.16.5.212\winsoft\Oracle\DR files to the /oracle directory
on both the primary and secondary nodes. Once copied open the S99startDR script and
replace the primaryhost and standbyhost entries with the hostnames of your primary and
standby servers. Open the standbyDB script and make sure that it is referencing the
proper location for the archive directory.
Starting up DR:
To start the DR issue the following command on both the primary and standby servers as
the root user from the /oracle directory: ./S99startDR start
Modifying Crontab for the New Standby:
On the standby server modify and add the following line to the crontab:
############ Below Entry is for Standby DR ##################
10,30,50 * * * * /oracle/standbyMON -S SID -s standbyhost -p primaryhost -m
sap_pm_team
########################################################

Das könnte Ihnen auch gefallen