Você está na página 1de 5

Creating standby physical database without using data guard

1. make sure if the primary server is in archivelog mode, to do that type


archive log list;
2. if your primary is not archivelog mode then enable that by doing:
a. create pfile for the primary server by typing
create pfile from spfile;
b. then edit the pfile (dont ever change spfile directly) the location is in
$ORACLE_HOME/dbs = UNIX or $ORACLE_HOME/database = windows
c. append the following parameter value in the end of the file
log_archive_dest_1=location=/destination/folder/archivelog;
log_archive_start=TRUE
if those parameter value already exist then you might need to change
the value and then save the pfile
d. to apply those changes you need to restart the primary server
shutdown abort;
startup open;
shutdown immediate;
then type this to apply the changes:
create spfile from pfile=/oracle/home/dbs/initAPP.ora;
e. then start the database with some configuration:
startup mount
alter database archivelog;
alter database open;
f. then check if archivelog already run or not by typing
archive log list;
3. After archiving already enabled then we need to copy all the admin_folder,
archivelog_folder, fast_recovery_area_folder, diag_folder, datafiles, redo log
files, init file (init-SIDNAME.ora), password file(orapwd in unix, pwd in
windows), listener, tnsnames.ora,and standby control file to the machine
that will become the standby physical server. To make the process easier it is
preferable having the same path to all database files. But we need to
shutdown the instance first (shutdown immediate).
4. To start a physical standby database it is required to have a standby control
file from primary server. it can be done by performing this command in the
sqlplus
SQL > alter database create standby controlfile as
/path/to/store/standby/controlfile;
5. After all the required files already copied to the physical standby database,
then you need to start editing the init files that you get from the primary
server, edit all the parameters that related with file path, you need to make
sure everything that is written in the init file exist in the physical standbys
OS.
6. Before starting the oracle database you also have to configure oracle
network, you can do this by editing listener.ora and tnsnames.ora in
$ORACLE_HOME/network/admin here is some example:

LISTENER.ORA
listener.ora Network Configuration File:
/u01/oracle/11g/network/admin/listene
r.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/11g)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = APRDEV)
(ORACLE_HOME = /u01/oracle/11g)
(GLOBAL_NAME = APRDEV)
)
(SID_DESC =
(SID_NAME = APRTEST)
(ORACLE_HOME = /u01/oracle/11g)
(GLOBAL_NAME = APRTEST)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = un01.aprdev.com)(PORT =
1521))
)
)
ADR_BASE_LISTENER = /u01/oracle

TNSNAMES.ORA
# tnsnames.ora Network Configuration File:
/u01/oracle/11g/network/admin/tnsname
s.ora
# Generated by Oracle configuration tools.
APRDEV_BCKP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.122.1.15)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = APRDEV)
)
)
APRTEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = un01.aprdev.com)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME = APRTEST)
)
)
after the tnsnames.ora and listener.ora already configured, then you need to
start the listener service by typing this command lsnrctl.start
7. login to the physical standby database using sqlplus and start the database:
bash~ > sqlplus sys as sysdba
SQL > startup nomount pfile=/path/to/initfile;
SQL > alter database mount standby database;
SQL > create spfile from pfile=/path/to/initfile;
8. after the physical standby database started, then you need to start copying
all the archive log files that is needed to start applying the log from primary
to physical standby database. in solaris you can synchronize the folder where
archivelog stored between two different server using rsync
9. To apply the archivelog for the first time the required command is:
SQL >recover standby database;
after that type AUTO.
10.To apply the archivelog after that it can be done by this command:
alter database recover automatic standby database; --lewati step ini

11.This process can be combined using shell script so that every 15 minutes the
archivelog from primary server are being send to the physical standby
database and those archivelogs are being applied every one hour.
12.To prove whether the database being updated or not you can make the
physical standby database opened in read only status. that can be done by
typing:
SQL >alter database open read only;
13.to make this database back to standby mode (after opening it open read
only) it can be done by typing:
SQL >shutdown immediate;
SQL >startup nomount;
SQL >alter database mount standby database;
14.While to create the log from the primary server, it can be done by doing:
SQL >alter system archive log current;
SQL >alter system switch logfile;
15.From the above script the archivelog are stored in one directory, that is
specified in the init file, log_archive_dest_1 To be able to send the archivelog
from the primary to standby database, we can use ssh script to utilize scp, or
we can use rsync tools for solaris.
16.If in any case the standby database wanted to be opened as a read write
database it can be done, the first thing that need to be done is to enable
flashback area and create a restore point.
17.To check whether your databases flashback area already configured or not,
you can check in init file if there are parameter db_recovery_file_dest and
.db_recovery_file_dest_size , if not then you need to add it first, by typing:
alter system set db_recovery_file_dest='/path/to/flashback/area' scope=both;
alter system set db_recovery_file_dest_size=2g scope=both;
18.
Then to activate flashback area, you need to do:
shutdown immediate;
startup nomount;
alter database mount standby database;
alter database flashback on; -- ORA-00439: feature not enabled:
Flashback Database (on standart edition)
19.Before activating this you need to be sure that your standby database is
already able to apply some logs, otherwise you will get ora-38788 more
standby database recovery is needed
20.After this we need to create restore point, that will be used when we want to
convert back the standby database that already becomes primary database,
back to standby database again. it can be done by typing :
SQL >create restore point restore_point_name guarantee flashback database;
21.Before creating restore point you need to makes sure that all archivelogs are
already being sent from primary to standby in event of failover.
22.Now you need to activate the standby database and open it for read/write
operations, it can be done by:
SQL >alter database activate standby database;

SQL >startup mount force;


23.We need to downgrade the protection mode to maximum performance
because this mode permits to work without a standby database protecting
the activated standby once opened. It can be done by:
SQL > alter database set standby database to maximize performance; -ORA-00439: feature not enabled: Managed Standby
24.Then we can open the standby database, by typing:
SQL >alter database open;
25.Now after all the necessity that need to be done, we can convert back the
activated standby database to physical standby database, it can be done by :
startup mount force;
SQL > flashback database to restore point restore01; -- ORA-00439: feature
not enabled: Managed Standby
SQL >alter database convert to physical standby;
SQL >shutdown immediate;
SQL >startup nomount;
SQL >alter database mount standby database;
26.now your standby is a standby again, and it ready to receive and apply new
archivelogs.
Checking:
SELECT OPEN_MODE,PROTECTION_MODE,DATABASE_ROLE FROM
V$DATABASE; (to check database role)
select name,db_unique_name,controlfile_type from v$database; (to view
controlfile status)
select current_scn from v$database;
select thread#, max(sequence#) as "last_applied_log" from v$log_history
group by thread#;
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY
SEQUENCE#; (for primary)
select ds.dest_id id , ad.status, ds.database_mode db_mode, ad.archiver
type, ds.recovery_mode , ds.protection_mode, ds.standby_logfile_count
"SRLs", ds.standby_logfile_active active, ds.archived_seq#
from v$archive_dest_status ds, v$archive_dest ad
where ds.dest_id = ad.dest_id and ad.status != 'INACTIVE' order by
ds.dest_id ;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;
ALTER DATABASE ACTIVATE PHYSICAL STANDBY DATABASE;
ALTER DATABASE OPEN;

Você também pode gostar