Varsayımlar: Standby database'de sadece software install edilmiş yada yaratılacak servis adı orada bulunmuyor. Primary ve Standby database isimleri birbirinden farklı
Primary Database'de sql komut satırından aşağıdaki komutlar çalıştırılı;
sqlplus sys/oracle as sysdba
ALTER DATABASE FORCE LOGGING;
alter database add standby logfile 'D:\app\ali.yagmur\oradata\ank\srl01.log' size 50M;
alter database add standby logfile 'D:\app\ali.yagmur\oradata\ank\srl02.log' size 50M;
alter database add standby logfile 'D:\app\ali.yagmur\oradata\ank\srl03.log' size 50M;
alter database add standby logfile 'D:\app\ali.yagmur\oradata\ank\srl04.log' size 50M;
alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';
alter system set log_archive_config='dg_config=(ank,anksb)';
alter system set log_archive_dest_2='service=anksb async valid_for=(online_logfile,primary_role) db_unique_name=anksb';
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1=ENABLE;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
alter system set log_archive_max_processes=30;
ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=SPFILE;
alter system set STANDBY_FILE_MANAGEMENT=AUTO;
*
o
+ bu sonrada yapılabilir. alter system set dg_broker_start=true;
alter system set DB_FILE_NAME_CONVERT='ank','anksb' scope=spfile;
alter system set LOG_FILE_NAME_CONVERT='D:\app\ali.yagmur\oradata\ank', 'c:\app\oracle\oradata\anksb' scope=spfile;
alter system set db_recovery_file_dest_size = 5G;
shutdown immediate;
startup mount;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
İkinci adım rman'le backup almak olacaktır.
rman target sys/oracle
backup database plus archivelog
Üçüncü adım listener ve tnsnames.ora dosyalarının düzenlenmesi olacaktır.
Listener.ora / Primary (Eklenecekler)
(SID_DESC =
(GLOBAL_DBNAME = ank)
(ORACLE_HOME = D:\app\ali.yagmur\product\11.2.0\dbhome_1)
(SID_NAME = ank)
)
(SID_DESC =
(GLOBAL_DBNAME = ank_DGMRL)
(ORACLE_HOME = D:\app\ali.yagmur\product\11.2.0\dbhome_1)
(SID_NAME = ank)
)
TnsNames.ora / Primary (Eklenecekler)
ANK =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ALIYAGMUR-PC.ug.net)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ank)
)
)
ANKSB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ydbase)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = anksb)
)
)
Listener.ora / Standby (Oldugu gibi)
# listener.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = c:\app\oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:c:\app\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = anksb)
(ORACLE_HOME = c:\app\oracle\product\11.2.0\dbhome_1)
(SID_NAME = anksb)
)
(SID_DESC =
(GLOBAL_DBNAME = anksb_DGMGRL)
(ORACLE_HOME = c:\app\oracle\product\11.2.0\dbhome_1)
(SID_NAME = anksb)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ydbase)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = c:\app\oracle
TnsNames.ora / Standby (As It is)
1. tnsnames.ora Network Configuration File: c:\app\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
2. Generated by Oracle configuration tools.
anksb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ydbase)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = anksb)
)
)
ank=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ALIYAGMUR-PC.ug.net)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ank)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
Sonraki aşamada primary database'de password dosyası yaratılır ve standby database'e kopyalanır.
orapwd file=d:\app\ali.yagmur\product\11.2.0\dbhome_1\database\PWDANK.ora password=oracle entries=10 ignorecase=y
dosya standby database'in ORACLE_HOME\database kalsörü altına kopyalanır.
Daha sonraki aşamada Standby database ile ilgili service yaratılır.
oradim -new -sid ANKSB -syspwd oracle (oracle : sys user'ının password'u)
Standby'da database ile ilgili klasörler oluşturulur :
mkdir c:\app\oracle\admin
mkdir c:\app\oracle\admin\anksb
mkdir c:\app\oracle\admin\anksb\adump
mkdir c:\app\oracle\admin\anksb\dpdump
mkdir c:\app\oracle\admin\anksb\pfile
mkdir c:\app\oracle\oradata
mkdir c:\app\oracle\oradata\anksb
mkdir c:\app\oracle\flash_recovery_area
mkdir c:\app\oracle\flash_recovery_area\anksb
Standby database'de init dosyası oluşturulur.
C:\app\oracle\product\11.2.0\dbhome_1\database\initANKSB.ora dosyasına ;
DB_NAME=ANKSB yazılır. (Eğer primary ve standby isimleri farklı olacaksa StdbyDbName STDBY olarak kullanılabilir.)
sonra sqlplus ile bağlanılarak standby database nomount durumunda açılır;
sqlplus sys/oracle@anksb as sysdba
startup nomount pfile='C:\app\oracle\product\11.2.0\dbhome_1\database\initANKSB.ora'
Son adım primary database rman ile duplicate komutunu çalıştırmak olacaktır:
rman target sys/oracle@ank auxiliary sys/oracle@ANKSB
RMAN> run{
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert 'ank','anksb'
set DB_FILE_NAME_CONVERT = 'd:\app\ali.yagmur\oradata\ank' , 'c:\app\oracle\oradata\anksb'
set LOG_FILE_NAME_CONVERT='d:\app\ali.yagmur\oradata\ank','c:\app\oracle\oradata\anksb'
set db_unique_name='anksb'
set db_create_file_dest='c:\app\oracle\oradata\anksb'
set db_recovery_file_dest='c:\app\oracle\flash_recovery_area'
set diagnostic_dest='c:\app\oracle'
set audit_file_dest='c:\app\oracle\admin\anksb\adump'
set db_recovery_file_dest_size='5G'
set control_files='c:\app\oracle\oradata\control01.ctl'
set log_archive_max_processes='5'
set fal_client='anksb'
set fal_server='ank'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(ank, anksb)'
set log_archive_dest_2='service=ank ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=ank';
}
Redo apply'ın çalışması için standby database'de şu komut çalıştırılabilir :
alter database recover managed standby database using current logfile disconnect from session;
No comments:
Post a Comment