快捷搜索:

Linux环境下oracle9i的Data guard配置(1) - oracle

情况:

os: linux 9

oracle: oracle9i

primary: 1.1.1.1

standby: 1.1.1.2 (主副主机都是两台通俗的pc主机)

第一部分 oracle9i 在linux9上的安装

原先我不想写这方面的东东,然则比较oracl9i在solaris下和在linux下安装,oracle9i 在linux9上的安装真的是要麻烦很多,下面我把我碰到的问题(似乎也是大年夜部分oracle初学者安装时碰到的题)简要的说一下,oracle9i 在linux9上的安装也折腾了我好几个月,没法子,我太笨了。

1)运行runinstaller的时刻报错。

-bash-2.05b$ ./runInstaller

-bash-2.05b$ Initializing Java Virtual Machine from

/tmp/OraInstall2005-01-20_06-39-06PM/jre/bin/java.

Please wait...

/tmp/OraInstall2005-01-20_06-39-06PM/jre/bin/i386/

native_threads/java: error

while loading shared libraries:

libstdc++-libc6.1-1.so.2: cannot open shared object

file: No such file or directory

Oracle Net configuration Assistant

Oracle Database configuration Assistant

Agent configuration Assistant

三个对象的details差错信息都是:

/home/oracle/jre/1.1.8/bin../lib/i686/

native_threads/libzip.so :symbol errno,

version GLIBC_2.0 not definded in file libc.so.6 with

link time reference(libzip.so)

unable to initialize threads:

cannot find class java/lang/Thread

Could not create java VM

办理措施:

在运行runInstaller之前做下面的步骤。

export LD_ASSUME_KERNEL=2.4.19

ignore your kernal version

下载文件libcwait.c

ftp://people.redhat.com/drepper/libcwait.c

(经由过程IE无法下载的话,就用敕令行)

用gcc -shared -o libcwait.so -fpic -O2 libcwait.c

进行编译然后export LD_PRELOAD=/$path/libcwait.so

上面的措施能使Oracle Net configuration Assistant ,

Oracle Database configuration Assistant 安装成功。

修复Agent configuration Assistant不能设置设置设备摆设摆设成功的措施:请参考chinaunix上的《在RHAS3上成功安装Oracle9204》。

运行runInstaller之后,呈现安装组件的选择结果,这时点“Install”,开始安装,复制文件,进度条在一点一点的增添,当安装并link 完后,呈现设置设置设备摆设摆设对象界面,agent办事不能设置设置设备摆设摆设成功,轻忽不用管,鄙人面修复。DBCA,NETCA,HTTP都精确设置设置设备摆设摆设完毕哦。

呵呵。下面开始修复差错。着实如果把各个界面抓取下来就更好了。

6、安装p3238244_9204_LINUX.zip补丁

此补丁也是从http://metalink.oracle.com下下载,同时要下载一个opatch软件包:p2617419_220_GENERIC.zip,它主如果用来悠agent办事不能启动的差错。

历程如下:

[quote:864939f94a]su - oracle

$ cp p2617419_210_GENERIC.zip /tmp

$ cd /tmp

$ unzip p2617419_210_GENERIC.zip

$ export PATH=$PATH:/tmp/OPatch

$ export PATH=$PATH:/sbin    # the patch needs "fuser" which is located in /sbin

$ unzip p3238244_9204_LINUX.zip

$ cd 3238244

$ opatch apply

:864939f94a]补丁修复完成,必要relinked一个.mk文件。

$ cd $ORACLE_HOME/network/lib

$ make -f ins_oemagent.mk install

第二步:Dataguard设置设置设备摆设摆设

首先将主副两主机都设为归档模式。

1. 主节点备份并天生备用数据库节制文件

登岸主节点,进行数据库备份,并天生备用数据库节制文件

[oracle@primary]$ sqlplus "/ as sysdba"

SQL> startup

SQL> shutdown immediate

SQL> exit

[oracle@primary]pwd

/home/oracle

[oracle@primary]$ ls

admin dictionary.ora jre oradata oraInventory oui product soft

[oracle@primary]tar -cvf oradata.tar oradata

[oracle@primary]$ ls -l *.tar

-rw-r--r--  1 oracle  dba   576512000 Aug 16 10:22 oradata.tar

[oracle@primary]$ sqlplus "/ as sysdba"

SQL> startup

SQL> archive log list;

Database log mode       Archive Mode

Automatic archival       Enabled

Archive destination      /home/oracle/oradata/primary/archive

Oldest online log sequence   88

Next log sequence to archive  90

Current log sequence      90

SQL> alter database create standby controlfile as '/home/oracle/standby.ctl';

Database altered.

SQL> exit

[oracle@primary]

3. 登岸备用节点(standby),ftp得到primary主机的数据库文件(即oradata.tar文件)、备用节制文件(/home/oracle/standby.ctl) ,口令文件( $ORACLE_HOME/dbs/下的orapworacle)传到standby里的响应位置。

详细步骤:

3.1 在standby的/home/oracle/oradata下,原本有一个oracle的文件夹(里面是该主机下的dbf,redolog文件),再新建一个primary文件夹。将primary主机的oradata.tar解开的文件整个直接(即primary不要再有文件夹)放到primary下,将刚天生的备用节制文件(/home/oracle/standby.ctl)也放到primary下。

改动standby主机的initoracle.ora文件(先备份),我的initoracle.ora如下,供参考

*.aq_tm_processes=1

*.background_dump_dest='/home/oracle/admin/primary/bdump'

*.compatible='9.2.0.0.0'

*.control_files='/home/oracle/oradata/primary/standby.ctl'

*.core_dump_dest='/home/oracle/admin/primary/cdump'

*.db_block_size=8192

*.db_cache_size=33554432

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='oracle'

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

*.fast_start_mttr_target=300

*.hash_join_enabled=TRUE

*.instance_name='oracle'

*.java_pool_size=83886080

*.job_queue_processes=10

*.large_pool_size=16777216

*.open_cursors=300

*.pga_aggregate_target=25165824

*.processes=150

*.query_rewrite_enabled='FALSE'

*.remote_login_passwordfile='EXCLUSIVE'

*.shared_pool_size=83886080

*.sort_area_size=524288

*.star_transformation_enabled='FALSE'

*.timed_statistics=TRUE

*.undo_management='AUTO'

*.undo_retention=10800

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/home/oracle/admin/primary/udump'

*.log_archive_format=log_%t_%s.arc

*.log_archive_start=TRUE

*.STANDBY_FILE_MANAGEMENT=AUTO

*.log_archive_dest_1='LOCATION=/home/oracle/oradata/archivelog/'

*.log_archive_dest_state_1 = ENABLE

*.fal_server='primary'

*.fal_client='standby'

*.DB_FILE_NAME_CONVERT=("/home/oracle/oradata/oracle","/home/oracle/oradata/primary")

----(主辅数据库数据文件互相转换的目录)

*.STANDBY_FILE_MANAGEMENT=AUTO 即可实现重命名主库的数据文件!!

*.LOG_FILE_NAME_CONVERT=("/home/oracle/oradata/archivelog","/home/oracle/oradata/archivelog")

----(主辅数据库联机日志redolog互相转换的目录)

*.STANDBY_ARCHIVE_DEST=/home/oracle/oradata/archivelog

----(从主数据库孕育发生的archivelog传到辅数据库的目录)

Database altered.

8. 在主节点设置归档路径

SQL> alter system set log_archive_dest_2='service=standby mandatory reopen=60';

System altered.

定义了主库向副库传输日志。

# 定义归档到备用库,强制归档,重试光阴60秒。

# 假如定义为可选状态(optional),那么在归档掉败后不会再次考试测验归档的。定义

# 为madatory状态后,假如本次归档掉败,则在归档下一个日志时会再次考试测验。

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL>

在备用节点察看日志:

[oracle@eygle bdump]$ tail -f alert_primary.log

MRP0: Background Managed Standby Recovery process started

Starting datafile 1 recovery in thread 1 sequence 90

Datafile 1: '/opt/oracle/oradata/primary/system01.dbf'

Starting datafile 2 recovery in thread 1 sequence 90

Datafile 2: '/opt/oracle/oradata/primary/undotbs01.dbf'

…………………………

-bash-2.05b$ mkdir /home/oracle/oradata/oracle/stdarch

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

9.主辅数据库的切换(竣事主数据库,启用备用数据库)

改动primary的参数文件initoracle.ora(先做好备份)

增添

*.standby_archive_dest='/home/oracle/oradata/standbyarch'

*.fal_server='standby'

*.fal_client='primary'

SQL>show parameter standby_file_management;

SQL> alter database mount standby database;

Database altered.

打开备用数据库(在standby主机上履行)

[oracle@standby oracle]$ sqlplus "/ as sysdba"

SQL> alter database commit to switchover to primary with session shutdown ;

Database altered.

SQL> shutdown immediate;

ORA-01507: database not mounted

ORACLE instance shut down

SQL>create spfile from pfile;

SQL> startup;

……

Database mounted.

Database opened.

SQL> select SEQUENCE#,GROUP#,STATUS from v$log;

SQL> select sequence#,group#,status from v$log;

SEQUENCE#   GROUP# STATUS

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

72     1 INACTIVE

73     2 INACTIVE

74     3 CURRENT

SQL> alter system switch logfile;

System altered.

SQL> select sequence#,group#,status from v$log;

SEQUENCE#   GROUP# STATUS

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

75     1 CURRENT

73     2 INACTIVE

74     3 ACTIVE

在primary主机上履行:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

Database altered.

在primary主机上察看日志利用环境

您可能还会对下面的文章感兴趣: