【Vegas原创】DG Build(Linux版)

2年前 (2022) 程序员胖胖胖虎阿
266 0 0
例:新建oratest的DG  DB:10.91.50.31  DG:10.91.50.6

DG:
1,建立相应的文件夹:

  mkdir  /u01/【Vegas原创】DG Build(Linux版)/admin/bdump ** ** 
  mkdir  
/u01/【Vegas原创】DG Build(Linux版)/oradata/


DB:
1,查logfile,controlfile路径,看是否在以上DG路径下,如果没有,继续在DG上建立:

SQL> select * from v$controlfile;
SQL
> select * from v$logfile;


2,查DB是否在Archive模式,若不在,请改为Archivelog模式。

3,shutdown DB。

4,create pfile1:

SQL> create pfile='/u01/app/oracle/product/10.1.0/db_1/dbs/initoratest1.ora' from spfile;


DG:
2,copy oradata文件:

$ scp 10.91.50.31:/u01/app/oracle/oradata/oratest/* /u01/app/oracle/oradata/oratest/


3,copy pfile、passwordfile文件:

$ scp 10.91.50.31:/u01/app/oracle/product/10.1.0/db_1/dbs/initoratest1.ora /u01/app/oracle/product/10.1.0/db_1/dbs
$ scp 
10.91.50.31:/u01/app/oracle/product/10.1.0/db_1/dbs/orapworatest /u01/app/oracle/product/10.1.0/db_1/dbs/


DB:
5,更改tnsname.ora,之后tnsping测试一下:

PRIMARYTEST=
(DESCRIPTION 
=
    (ADDRESS 
= (PROTOCOL = TCP)(HOST = 10.91.50.31)(PORT = 1521))
    (CONNECT_DATA 
=
      (SERVER 
= DEDICATED)
      (SERVICE_NAME 
= ORATEST)
    )
  )

STANDBYTEST=
(DESCRIPTION 
=
    (ADDRESS 
= (PROTOCOL = TCP)(HOST = 10.91.50.6)(PORT = 1521))
    (CONNECT_DATA 
=
      (SERVER 
= DEDICATED)
      (SERVICE_NAME 
= ORATEST)
    )
   )


6,shutdownDB,更改pfile:

*.log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/oratest/archivelog'
*.log_archive_dest_2='SERVICE=standbytest MANDATORY REOPEN=60'
*.log_archive_format=ARC%S_%R.%T
*.fal_server=standbytest
*.fal_client=primarytest
*.standby_archive_dest='/u01/app/oracle/oradata/oratest/standbylog'
*.standby_file_management=auto


7,用更改的pfile start DB:

SQL> startup pfile='/u01/app/oracle/product/10.1.0/db_1/dbs/initoratest.ora';


SQL> create spfile from pfile='/u01/app/oracle/product/10.1.0/db_1/dbs/initoratest.ora';
SQL
> startup force;


DG:
4,更改pfile:

*.log_archive_dest_1='LOCATION=/u01/app/oracle/oradata/oratest/archivelog'
*.log_archive_dest_2='SERVICE=primarytest MANDATORY REOPEN=60'
*.log_archive_dest_state_2=defer
*.log_archive_format=ARC%S_%R.%T
*.fal_server=primarytest
*.fal_client=standbytest
*.standby_archive_dest='/u01/app/oracle/oradata/oratest/standbylog'
*.standby_file_management=auto


DB:
8,建立DG的control文件:

SQL> alter database create standby controlfile as '/u01/app/oracle/oradata/oratest/standby.ctl';


DG:
5,将control文件copy,并改名

$ scp 10.91.50.31:/u01/app/oracle/oradata/oratest/standby.ctl /u01/app/oracle/oradata/oratest/standby.ctl                                                     100% 2800KB  10.4MB/s   00:00    
$ cd 
/u01/app/oracle/oradata/oratest/
$ cp standby.ctl control01.ctl
$ cp standby.ctl control02.ctl
$ cp standby.ctl control03.ctl


6,startup mount DG:

$ export ORACLE_SID=oratest
SQL
> startup nomount pfile='/u01/app/oracle/product/10.1.0/db_1/dbs/initoratest.ora';
SQL
> alter database mount standby database;


7,添加Standby log:

SQL> alter database add standby logfile group 4 ('/u01/app/oracle/oradata/oratest/standbyredo01.log') size 10m;
SQL
> alter database add standby logfile group 5 ('/u01/app/oracle/oradata/oratest/standbyredo02.log') size 10m;
SQL
> alter database add standby logfile group 6 ('/u01/app/oracle/oradata/oratest/standbyredo03.log') size 10m;


8,

SQL> alter database recover managed standby database disconnect from session;


9,tail alertlog,查看DB切日志时的执行情况:

$ cd /u01/app/oracle/admin/oratest/bdump
$ tail 
-f alert_oratest.log 


DB:
9,切日志:

SQL> alter system switch logfile;
SQL
> /
SQL
> /


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

常见alert错误解决:
1,
现象:
FAL[client]: Failed to request gap sequence for thread 1 gap sequence 5-13
FAL[client]: All defined FAL servers have been attempted.
-------------------------------------------------------------
Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization
parameter is defined to a value that is sufficiently large
enough to maintain adequate log switch information to resolve
archivelog gaps.
-------------------------------------------------------------

产生原因:
起初DB忘记改为ArchiveLog模式,当DG做到最后一步的时候,发现没有ArchiveLog,随后手动在DB、DG上开启ArchiveLog,此后会产生此问题。

解决方案:
重做。

2,
现象:
Errors in file /u01/app/oracle/admin/oratest/bdump/oratest_arc0_29973.trc:
ORA-16038: log 4 sequence# 73 cannot be archived
ORA-16040: standby destination archive log file is locked
ORA-00312: online log 4 thread 1: '/u01/app/oracle/oradata/oratest/standbyredo01.log'

解决方案:http://www.cnblogs.com/vegaslee/archive/2009/08/03/1537753.html DG部分。

3,
现象:ORA-16040: standby destination archive log file is locked

解决方案:
详见:http://www.cnblogs.com/vegaslee/archive/2009/08/12/1544199.html 

 

版权声明:程序员胖胖胖虎阿 发表于 2022年9月14日 下午1:16。
转载请注明:【Vegas原创】DG Build(Linux版) | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...