首页 > 数据库 > Oracle > 11G RAC下开归档 linux5.5 虚拟机
11G RAC下开归档
2014年4月19日
22:17
1.创建目录赋予权限
两个节点创建相同的目录
[root@pdd1 ~]# mkdir /u01/archive
[root@pdd1 ~]# chown oracle:dba /u01/archive
2.建立共享
由于RAC环境,所以要通过NFS共享归档
|
[root@pdd1 ~]# vi /etc/exports |
用这个文件建立共享 |
添加
|
/u01/arch1 *(rw,async) |
rw读写权限 async同步 |
|
[root@pdd1 ~]# service nfs start |
启动NFS服务 |
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
|
[root@pdd1 ~]# chkconfig nfs on |
设置开机启动NFS |
可以用exportfs -av查看共享
[root@pdd1 ~]# exportfs -av
exporting *:/u01/archive
exportfs是查看和导出本地的共享目录
cat /etc/exports里面就是你的共享目录,用exportfs可以查看
参数说明如下。
(1)-a:全部挂载(或卸载)/etc/exports文件内的设定。
(2)-r:重新挂载/etc/exports中的设置,此外同步更新/etc/exports及/var/lib/nfs/xtab中的内容。
(3)-u:卸载某一目录。
(4)-v:在export时将共享的目录显示在屏幕上。
在节点2查看
[root@pdd2 ~]# showmount -e pdd1
Export list for pdd1:
/u01/archive *
可以看到pdd1将/u01/archive目录共享给了所有人(*)
将pdd1共享出来的目录挂载到pdd2上
[root@pdd2 ~]# mount -t nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,timeo=600,actimeo=0 pdd1:/u01/archive /u01/archive
[root@pdd2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.7G 3.8G 1.7G 70% /
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 782M 394M 388M 51% /dev/shm
/dev/sdb1 20G 8.6G 11G 46% /u01
pdd1:/u01/archive 20G 8.6G 11G 46% /u01/archive
-t nfs 表示文件系统类型 -o参数 对mount过来的目录有rw读写权限 bg以后台方式进行mount hard以硬链接的方式进行Mount一直连接直到成功 nointr不支持nfs协议,rsize读取数据块缓冲区的大小,wsize写入的大小
3.设置开机自动挂载
[root@pdd2 ~]# vi /etc/fstab
pdd1:/u01/archive /u01/archive nfs rw,bg,hard,nointr,rsize=32768,wsize=32768,timeo=600,actimeo=0 0 0
4.打开归档
|
[oracle@pdd1 ~]$ srvctl stop database -d prod |
先关闭数据库 |
|
srvctl start instance -d prod -i prod1 -o mount |
启动一个实例到mount |
[oracle@pdd1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Apr 19 23:21:40 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select instance_name,status from gv$instance;
INSTANCE_NAME STATUS
---------------- ------------
prod1 MOUNTED
开归档
SQL> alter database archivelog;
Database altered.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 5
Next log sequence to archive 6
Current log sequence 6
开归档后使用了默认路径
so 更改归档位置
SQL> alter system set log_archive_dest_1='location=/u01/archive' scope=spfile;
System altered.
SQL> alter system set log_archive_format='arch_%t_%s_%r.log' scope=spfile;
System altered.
startup force mount
alter database open
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/archive
Oldest online log sequence 5
Next log sequence to archive 6
Current log sequence 6
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29492784/viewspace-1145590/ ,如需转载,请注明出处,否则将追究法律责任。