Chinaunix首页 | 论坛 | 博客
  • 博客访问: 239139
  • 博文数量: 59
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 592
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-01 12:51
个人简介

你们都是我的客户,所以,我对你们是透明的

文章分类

全部博文(59)

文章存档

2016年(29)

2015年(30)

分类: Oracle

2015-10-30 14:57:41

1、

主库备库均安装相同版本的11.2.0.4RDBMS数据库软件并netca建立监听。除此之外主库dbca创建credit数据库实例。

2、修改数据库force_logging模式

SQL> select force_logging from v$database;


FOR

---

NO


SQL>



SQL> alter database force logging;


Database altered.


SQL> select force_logging from v$database;


FOR

---

YES


SQL>

3、

设置本地归档路径

SQL> alter system set log_archive_dest_1='location=/arch' scope=both;


SQL> alter system set log_archive_dest_1='location=/arch' scope=both;


System altered.


SQL> show parameter log


NAME                                 TYPE        VALUE

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

audit_syslog_level                   string

commit_logging                       string

db_create_online_log_dest_1          string

db_create_online_log_dest_2          string

db_create_online_log_dest_3          string

db_create_online_log_dest_4          string

db_create_online_log_dest_5          string

enable_ddl_logging                   boolean     FALSE

log_archive_config                   string

log_archive_dest                     string

log_archive_dest_1                   string      location=/arch

4、

关闭11g新特性

调整密码不过期

 alter profile default limit  PASSWORD_LIFE_TIME unlimited;

调整登入限制

 alter profile default limit  FAILED_LOGIN_ATTEMPTS unlimited;


SQL> alter profile default limit  PASSWORD_LIFE_TIME unlimited;


Profile altered.


SQL>  alter profile default limit  FAILED_LOGIN_ATTEMPTS unlimited;


Profile altered.


SQL>


5、开归档

SQL> startup mount

ORACLE instance started.


Total System Global Area  300630016 bytes

Fixed Size                  2252704 bytes

Variable Size             167772256 bytes

Database Buffers          125829120 bytes

Redo Buffers                4775936 bytes

Database mounted.



SQL> alter database archivelog;


Database altered.


SQL> alter database open;


Database altered.


SQL> archive log llist

SP2-0718: illegal ARCHIVE LOG option

SQL> archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /arch

Oldest online log sequence     1

Next log sequence to archive   2

Current log sequence           2


6、设置备库归档路径

alter system set log_archive_dest_2='SERVICE=his_std lgwr async valid_for=(online_logfile,primary_role) db_unique_name=his_std';


应用归档路径

ALTER SYSTEM set LOG_ARCHIVE_DEST_STATE_1=ENABLE SCOPE=BOTH;

ALTER SYSTEM set LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;


SQL> ALTER SYSTEM set LOG_ARCHIVE_DEST_STATE_1=ENABLE SCOPE=BOTH;


System altered.


SQL>

SQL> ALTER SYSTEM set LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;


System altered.


SQL>

7、主备一致


ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT =AUTO SCOPE=both;

SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT =AUTO SCOPE=both;


System altered.


SQL>



8、

设置falover切换参数

ALTER SYSTEM set FAL_SERVER=' his_std' SCOPE=BOTH;

ALTER SYSTEM set FAL_CLIENT=' his' SCOPE=BOTH;


到时候备库反过来


9、redo传输

alter system set log_archive_config='dg_config=(his,his_std)';


SQL> alter system set log_archive_config='dg_config=(his,his_std)';


System altered.


SQL>



10、修改tns

创建连接主备连接串

vi $ORACLE_HOME/network/admin/tnsnames.ora

添加如下内容

his =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.104)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = his)

    )

  )


his_std =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.222)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = his_std)

    )

  )

11、主库创建 standby logfile


alter database add logfile group 4 '/oracle/app/oracle/oradata/his/redo04.log'size 50m;

alter database add logfile group 5 '/oracle/app/oracle/oradata/his/redo05.log'size 50m;

alter database add logfile group 6 '/oracle/app/oracle/oradata/his/redo06.log'size 50m;

alter database add logfile group 7 '/oracle/app/oracle/oradata/his/redo07.log'size 50m;


12、

创建备库参数文件

create pfile from spfile;

创建备库控制文件

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/control01.ctl';

拷贝参数文件($ORACLE_HOME/dbs/initcredit.ora)和控制文件到备库目录下($ORACLE_HOME/dbs/./oradata/credit)

拷贝密码文件($ORACLE_HOME/dbs/orapwcredit)到备库($ORACLE_HOME/dbs/.)

拷贝数据文件(/oradata/credit/*.dbf)到备库(/oradata/credit/.)

拷贝tns文件($ORACLE_HOME/network/admin/tnsnames.ora)到备库相同目录

创建监听文件




13、备端修改


创建日志文件夹内

mkdir /oracle/diag/rdbms/his/his

修改参数文件

Vi $ORACLE_HOME/dbs/initcredit.ora

log_archive_dest_2='SERVICE=his lgwr ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=his_std'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=his_stdXDB)'

FAL_SERVER='his';

FAL_CLIENT='his_std' ;

controlfle位置,具体


14、mount备库应用日志

 mkdir -p /oracle/app/oracle/oracle/admin/his

cd his


 mkdir adump dpdump pfile


14.1 


startup nomount


alter database mount standby database;

alter database recover managed standby database disconnect from session; 

alter database recover managed standby database cancel;


alter database add logfile group 4 '/oracle/app/oracle/oradata/his/redo04.log'size 50m;

alter database add logfile group 5 '/oracle/app/oracle/oradata/his/redo05.log'size 50m;

alter database add logfile group 6 '/oracle/app/oracle/oradata/his/redo06.log'size 50m;

alter database add logfile group 7 '/oracle/app/oracle/oradata/his/redo07.log'size 50m;


alter database recover managed standby database disconnect from session; 

alter database recover managed standby database cancel;


select process,status from v$managed_standby;

select max(sequence#) from v$archived_log;



这样就正常了

SQL> select process,status from v$managed_standby;


PROCESS   STATUS

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

ARCH      CONNECTED

ARCH      CONNECTED

ARCH      CONNECTED

ARCH      CONNECTED

RFS       IDLE

RFS       IDLE

RFS       IDLE

MRP0      WAIT_FOR_LOG

阅读(2057) | 评论(0) | 转发(0) |
0

上一篇:aix 6安装Oracle 11g

下一篇:rhel6安装 10g问题

给主人留下些什么吧!~~