This article describes how to build a Acfs file system on a virtual machine that already has 12c RAC installed, and use the ACFS snapshot to brush a cow (Copy-On-Write) library to do the test library.
Highlight Step:
Add ASM disk to virtual machine to build Acfs file system
Second, create Acfs file system
Third, create the database on the Acfs file system in Node 1. (12c supports data files, control files, log files and other database files on the ACFS.) Reference doc ID 1369107.1 acfs Advanced Features Platform availability–minimum Version)
Four, while running DML on Node 1, generate snapshot
V. Use the snapshot generated above to pull up another database on Node 2.
Add ASM disk to virtual machine to build Acfs file system
1. Create a shared ACFS disk, a total of 3 disks, 3G size per disk:
Vboxmanage Createhd--filename asm_acfs_3g_01.vdi--size 3072 VDI--format Fixed
Vboxmanage Createhd--filename asm_acfs_3g_02.vdi--size 3072 VDI--format Fixed
Vboxmanage Createhd--filename asm_acfs_3g_03.vdi--size 3072 VDI--format Fixed
2. Attach the ASM disk created to the virtual machine OL6-121-RAC1
Vboxmanage storageattach ol6-121-rac1--storagectl "SATA"--port 5--device 0--type HDD--medium ASM_ACFS_3G_01.VDI- -mtype shareable
Vboxmanage storageattach ol6-121-rac1--storagectl "SATA"--port 6--device 0--type HDD--medium ASM_ACFS_3G_02.VDI- -mtype shareable
Vboxmanage storageattach ol6-121-rac1--storagectl "SATA"--port 7--device 0--type HDD--medium ASM_ACFS_3G_03.VDI- -mtype shareable
Vboxmanage storageattach ol6-121-rac2--storagectl "SATA"--port 5--device 0--type HDD--medium ASM_ACFS_3G_01.VDI- -mtype shareable
Vboxmanage storageattach ol6-121-rac2--storagectl "SATA"--port 6--device 0--type HDD--medium ASM_ACFS_3G_02.VDI- -mtype shareable
Vboxmanage storageattach ol6-121-rac2--storagectl "SATA"--port 7--device 0--type HDD--medium ASM_ACFS_3G_03.VDI- -mtype shareable
3. Set these shared disks to be sharable:
Vboxmanage MODIFYHD Asm_acfs_3g_01.vdi--type shareable
Vboxmanage MODIFYHD Asm_acfs_3g_02.vdi--type shareable
Vboxmanage MODIFYHD Asm_acfs_3g_03.vdi--type shareable
4. Into the Linux system, to partition the new disk
Fdisk/dev/sd<n>--> N-->p-->1-->1-->w
Such as:
FDISK/DEV/SDF--> N-->p-->1-->1-->w
FDISK/DEV/SDG--> N-->p-->1-->1-->w
FDISK/DEV/SDH--> N-->p-->1-->1-->w
5. This article uses the ASM disk in a udev way, without using Asmlib.
/sbin/scsi_id-g-u-d/dev/sdf
/sbin/scsi_id-g-u-d/dev/sdg
/sbin/scsi_id-g-u-d/DEV/SDH
such as:
[roo T@ol6-121-rac1 dev]#/sbin/scsi_id-g-u-d/dev/sdf
1ata_vbox_harddisk_vba36c3c6c-9da6bb20
[Root@ol6-121-rac1 dev]#/sbin/scsi_id-g-u-d/DEV/SDG
1ATA_VBOX_HARDDISK_VBCB790F45-DE2F86FB
[Root@ol6-121-rac1 dev]#/sbin/ Scsi_id-g-u-d/DEV/SDH
1ata_vbox_harddisk_vb4489ed5a-e05a9613
[Root@ol6-121-rac1 dev]#
6. After obtaining the above information, In the two-node/etc/udev/rules.d/99-oracle-asmdevices.rules file, add the following lines:
kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "1ata_vbox_harddisk_" Vba36c3c6c-9da6bb20 ", name=" asm_acfs_3g_01 ", owner=" Oracle ", group=" DBA ", mode=" 0660
kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "1ata_vbox_harddisk_" VBCB790F45-DE2F86FB ", name=" asm_acfs_3g_02 ", owner=" Oracle ", group=" DBA ", mode=" 0660
kernel== "Sd?1", bus== "scsi", program== "/sbin/scsi_id-g-u-d/dev/$parent", result== "1ata_vbox_harddisk_" vb4489ed5a-e05a9613 ", name=" asm_acfs_3g_03 ", owner=" Oracle ", group=" DBA ", mode=" 0660
7. Restart the two-node Udev service, or directly restart two nodes:
Crsctl Stop CRS
/sbin/udevadm Control--reload-rules
/sbin/start_udev
Second, create Acfs file system
8. At two nodes, create mount point for ACFS file system
[Root@ol6-121-rac1 ~]# mkdir-p/mnt/acfs
[Root@ol6-121-rac1 ~]# chown Oracle:oinstall/mnt/acfs
[Root@ol6-121-rac2 ~]# mkdir-p/mnt/acfs
[Root@ol6-121-rac2 ~]# chown Oracle:oinstall/mnt/acfs
9. First check the disk that can be used for new DiskGroup
Sql> Select path, name, Header_status, os_mb from V$asm_disk;
PATH NAME Header_statu OS_MB
------------------------------ ------------------------------ ------------ ----------
/DEV/ASM_ACFS_3G_03 candidate 3067
/DEV/ASM_ACFS_3G_01 candidate 3067
/DEV/ASM_ACFS_3G_02 candidate 3067
/dev/asm-disk1 data_0000 member 5114
/dev/asm-disk2 data_0001 member 5114
/DEV/ASM-DISK3 DATA_0002 member 5114
/DEV/ASM-DISK4 data_0003 member 5114
7 rows selected.
10. New DiskGroup Dg_acfs
sql> CREATE diskgroup dg_acfs EXTERNAL Redundancy DISK
2 '/dev/asm_acfs_3g_01 ' SIZE 3000M,
3 '/dev/asm_acfs_3g_02 ' size 3000M,
4 '/dev/asm_acfs_3g_03 ' size 3000M
5 ATTRIBUTE ' compatible.asm ' = ' 12.1.0.0.0 ';
DiskGroup created.
Sql>
11. Set compatible for more than 12.1
Sql> alter diskgroup DG_ACFS set attribute ' compatible.advm ' = ' 12.1.0.0.0 ';
DiskGroup altered.
You can also:
asmcmd> setattr-g Dg_acfs COMPATIBLE.ADVM 12.1.0.0.0
12. Establishment of Volumns
Sql> alter DiskGroup DG_ACFS add volume VOL1 size 8000M;
DiskGroup altered.
You can also:
asmcmd> volcreate-g dg_acfs-s 8000M--column 1 VOL1
13. Check Equipment Name:
Sql> Select Volume_name,volume_device from V$asm_volume
2/
Volume_Name Volume_device
------------------------------ ----------------------------------------
vol1/dev/asm/vol1-28 <<<<<< device name, next MKFS will be used
Sql>
can also
asmcmd> volinfo-g Dg_acfs VOL1
DiskGroup NAME:DG_ACFS
Volume Name:vol1
Volume Device:/dev/asm/vol1-28 <<<<<< device name, next MKFS will be used
State:enabled
Size (MB): 8000
Resize Unit (MB): 32
Redundancy:unprot
Stripe columns:4
Stripe Width (K): 128
Usage:
Mountpath:
Asmcmd>
14. Establishment of a file system:
[Root@ol6-121-rac1 ~]# mkfs-t acfs/dev/asm/vol1-28
Mkfs.acfs:version = 12.1.0.1.0
Mkfs.acfs:on-disk Version = 39.0
Mkfs.acfs:volume =/dev/asm/vol1-28
Mkfs.acfs:volume size = 8388608000
Mkfs.acfs:Format complete.
[Root@ol6-121-rac1 ~]#
15. Register the Acfs file system with CRS:
[Root@ol6-121-rac1 ~]# acfsutil registry-a/DEV/ASM/VOL1-28/MNT/ACFS
Acfsutil Registry:mount Point/mnt/acfs successfully added to Oracle registry
[Root@ol6-121-rac1 ~]#
Or:
[Root@ol6-121-rac1 ~]# srvctl add filesystem-m/mnt/acfs-d/dev/asm/vol1-28
16. Mount the Acfs file system to mount point:
[Root@ol6-121-rac1 ~]# Df-k
FileSystem 1k-blocks Used Available use% mounted on
/dev/mapper/vg_ol6121rac1-lv_root
28423176 16096244 10883092 60%/
Tmpfs 2560000 2038752 521248 80%/DEV/SHM
/DEV/SDA1 495844 56258 413986 12%/boot
[Root@ol6-121-rac1 ~]#
[Root@ol6-121-rac1 ~]# mount-t Acfs/dev/asm/vol1-28/mnt/acfs
[Root@ol6-121-rac1 ~]#
[Root@ol6-121-rac1 ~]# Df-k
FileSystem 1k-blocks Used Available use% mounted on
/dev/mapper/vg_ol6121rac1-lv_root
28423176 16096324 10883012 60%/
Tmpfs 2560000 2038752 521248 80%/DEV/SHM
/DEV/SDA1 495844 56258 413986 12%/boot
/dev/asm/vol1-190 9117696 57360 9060336 1%/MNT/ACFS
[Root@ol6-121-rac1 ~]#
17. Check Status:
[root@ol6-121-rac1 ~]# srvctl config filesystem-d/dev/asm/vol1-28
Volume Device:/dev/asm/vol1-190
Canonical Volume Device:/dev/asm/vol1-190
Mountpoint Path:/MNT/ACFS
User:
Type:acfs
Mount options:
Description:
Nodes:
Server Pools:
Application ID:
ACFS file system is enabled
[Root@ol6-121-rac1 ~]#
[Root@ol6-121-rac1 ~]# srvctl status filesystem-d/dev/asm/vol1-28
ACFS file System/mnt/acfs is mounted on nodes OL6-121-RAC1,OL6-121-RAC2
[Root@ol6-121-rac1 ~]#
Third, create the database on the Acfs file system in Node 1.
18. Use DBCA to create a database on the Acfs file system. Note that the type of the storage type is to select File system and select the mount point that is established above.
The concrete step is slightly.
19. Check the created DB, the DB instance we tested here is named Acfsdb:
--------------------------------------------------------------------------------
Name Target State Server Details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
Ora. Asmnet1lsnr_asm.lsnr
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
Ora. Data.dg
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
Ora. Dg_acfs. Vol1.advm
Online online Ol6-121-rac1 Volume device/dev/a
Sm/vol1-28 is online
, stable
Online online Ol6-121-rac2 Volume device/dev/a
Sm/vol1-28 is online
, stable
Ora. Dg_acfs.dg
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
Ora. Listener.lsnr
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
Ora.dg_acfs.vol1.acfs
Online online OL6-121-RAC1 mounted ON/MNT/ACFS
, stable
Online online OL6-121-RAC2 mounted ON/MNT/ACFS
, stable
Ora.net1.network
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
Ora.ons
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
Ora.proxy_advm
Online Online Ol6-121-rac1 Stable
Online Online OL6-121-RAC2 Stable
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
Ora. Listener_scan1.lsnr
1 Online Online Ol6-121-rac2 stable
Ora. Listener_scan2.lsnr
1 Online Online Ol6-121-rac1 stable
Ora. Listener_scan3.lsnr
1 Online Online Ol6-121-rac1 stable
Ora.acfsdb.db
1 Online Online Ol6-121-rac1 open,stable
Ora.asm
1 Online Online Ol6-121-rac1 stable
2 Online Online Ol6-121-rac2 stable
3 OFFLINE OFFLINE Stable
Ora.cdbrac.db
1 OFFLINE OFFLINE Instance shutdown,st
Able
2 OFFLINE OFFLINE Instance shutdown,st
Able
Ora.cvu
1 Online Online Ol6-121-rac1 stable
Ora.gns
1 Online Online Ol6-121-rac1 stable
Ora.gns.vip
1 Online Online Ol6-121-rac1 stable
Ora.oc4j
1 OFFLINE OFFLINE Stable
Ora.ol6-121-rac1.vip
1 Online Online Ol6-121-rac1 stable
Ora.ol6-121-rac2.vip
1 Online Online Ol6-121-rac2 stable
Ora.scan1.vip
1 Online Online Ol6-121-rac2 stable
Ora.scan2.vip
1 Online Online Ol6-121-rac1 stable
Ora.scan3.vip
1 Online Online Ol6-121-rac1 stable
--------------------------------------------------------------------------------
[oracle@ol6-121-rac1 ~]$ srvctl config database-d acfsdb
Database Unique Name:acfsdb
Database Name:acfsdb
Oracle Home:/u01/app/oracle/product/12.1.0.1/db_1
Oracle user:oracle
Spfile:/u01/app/oracle/product/12.1.0.1/db_1/dbs/spfileacfsdb.ora
Password file:
Domain:
Start Options:open
Stop options:immediate
Database role:primary
Management policy:automatic
Server Pools:acfsdb
Database Instance:acfsdb
Disk Groups:
Mount Point paths:
Services:
Type:single
Database is administrator managed
Sql> select file_name from Dba_data_files;
file_name
--------------------------------------------------------------------------------
/mnt/acfs/oradata/acfsdb/system01.dbf
/mnt/acfs/oradata/acfsdb/sysaux01.dbf
/mnt/acfs/oradata/acfsdb/undotbs01.dbf
/mnt/acfs/oradata/acfsdb/users01.dbf
Sql>
Sql> select name from V$controlfile;
NAME
--------------------------------------------------------------------------------
/mnt/acfs/oradata/acfsdb/control01.ctl
/mnt/acfs/oradata/acfsdb/control02.ctl
Sql>
Sql>
Sql>
Sql> Select member from V$logfile;
Member
--------------------------------------------------------------------------------
/mnt/acfs/oradata/acfsdb/redo01.log
/mnt/acfs/oradata/acfsdb/redo02.log
/mnt/acfs/oradata/acfsdb/redo03.log
Sql> select file_name from Dba_temp_files;
file_name
--------------------------------------------------------------------------------
/mnt/acfs/oradata/acfsdb/temp01.dbf
Sql>
Four, while running DML on Node 1, generate snapshot
20. Our command to create snapshot is acfsutil, so let's take a look at the current snapshot:
[Oracle@ol6-121-rac1 logs]$ acfsutil Snap Info/mnt/acfs
Number of snapshots:0
Snapshot Space usage:0
[Oracle@ol6-121-rac1 logs]$
21. We first try to create a read-only (read-only, RO) Snapshot:
[oracle@ol6-121-rac1 logs]$ date
Wed Feb 22:40:34 CST 2016
[oracle@ol6-121-rac1 logs]$ acfsutil Snap Create ASFSDB_SNAP01/MNT/ACFS
Acfsutil Snap create:snapshot operation is complete.
[Oracle@ol6-121-rac1 logs]$ date
Wed Feb 22:40:40 CST 2016
[oracle@ol6-121-rac1 logs]$ acfsutil Snap info/mnt/ ACFS
Snapshot name: Asfsdb_snap01
Ro snapshot or RW snapshot: ro <<<<<<<< Note here, similar to Ro, that is, read-only.
Parent name: /MNT/ACFS
Snapshot creation time: Wed Feb-22:40:36 2016
number of snapshots: 1
snapshot space usage:122757120
[ Oracle@ol6-121-rac1 logs]$
22. Note that the above snapshot file is based on an implied directory under your mount point. ACFS under:
[Root@ol6-121-rac1 acfsdb]# cd/mnt/acfs/. Acfs/snaps/asfsdb_snap01/oradata/acfsdb
[Root@ol6-121-rac1 acfsdb]# Ls-al
Total 1714424
Drwxr-x---. 2 Oracle Oinstall 8192 Feb 24 21:27.
Drwxr-x---. 3 Oracle Oinstall 8192 Feb 24 21:25.
-rw-r-----. 1 Oracle DBA 10043392 Feb 22:40 control01.ctl
-rw-r-----. 1 Oracle DBA 10043392 Feb 22:40 control02.ctl
-rw-r-----. 1 Oracle DBA 52429312 Feb 22:03 Redo01.log
-rw-r-----. 1 Oracle DBA 52429312 Feb 22:40 Redo02.log
-rw-r-----. 1 Oracle DBA 52429312 Feb 22:01 Redo03.log
-rw-r-----. 1 Oracle DBA 576724992 Feb 22:40 sysaux01.dbf
-rw-r-----. 1 Oracle DBA 734011392 Feb 22:39 system01.dbf
-rw-r-----. 1 Oracle DBA 20979712 Feb 22:40 temp01.dbf
-rw-r-----. 1 Oracle DBA 241180672 Feb 22:39 undotbs01.dbf
-rw-r-----. 1 Oracle DBA 5251072 Feb 22:38 users01.dbf
[Root@ol6-121-rac1 acfsdb]#
23. We may as well build a few more snapshot:
[Oracle@ol6-121-rac1 ~]$ Date
Wed Feb 22:52:45 CST 2016
[Oracle@ol6-121-rac1 ~]$ acfsutil snap create-w Asfsdb_snap02/mnt/acfs
Acfsutil Snap Create:snapshot operation is complete.
[Oracle@ol6-121-rac1 ~]$ Date
Wed Feb 22:52:45 CST 2016
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$ acfsutil Snap Info/mnt/acfs
Snapshot name:asfsdb_snap01
RO Snapshot or RW Snapshot:ro
Parent Name:/MNT/ACFS
Snapshot creation time:wed Feb 24 22:40:36 2016
Snapshot name:asfsdb_snap02
RO Snapshot or RW snapshot:rw
Parent Name:/MNT/ACFS
Snapshot creation time:wed Feb 24 22:52:45 2016
Number of Snapshots:2
Snapshot Space usage:265420800
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$ Date
Acfsutil Snap Create-w Asfsdb_snap03/mnt/acfs
Datethu Feb 15:15:08 CST 2016
[Oracle@ol6-121-rac1 ~]$ acfsutil snap create-w Asfsdb_snap03/mnt/acfs
Acfsutil Snap Create:snapshot operation is complete.
[Oracle@ol6-121-rac1 ~]$ Date
Thu Feb 15:15:11 CST 2016
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$ Date
Thu Feb 15:15:33 CST 2016
[Oracle@ol6-121-rac1 ~]$ acfsutil snap create-w Asfsdb_snap04/mnt/acfs
Acfsutil Snap Create:snapshot operation is complete.
[Oracle@ol6-121-rac1 ~]$ Date
Thu Feb 15:15:33 CST 2016
[Oracle@ol6-121-rac1 ~]$
24. It can be seen that 4 snapshot have been established. The first one is read-only (RO), and the latter 3 are read/write (RW). The difference is whether you add the-w argument when you create it with Acfsutil. Otherwise, the no-w parameter is read-only by default.
[Oracle@ol6-121-rac1 ~]$ acfsutil Snap Info/mnt/acfs
Snapshot name:asfsdb_snap01
RO Snapshot or RW Snapshot:ro
Parent Name:/MNT/ACFS
Snapshot creation time:wed Feb 24 22:40:36 2016
Snapshot name:asfsdb_snap02
RO Snapshot or RW snapshot:rw
Parent Name:/MNT/ACFS
Snapshot creation time:wed Feb 24 22:52:45 2016
Snapshot name:asfsdb_snap03
RO Snapshot or RW snapshot:rw
Parent Name:/MNT/ACFS
Snapshot creation Time:thu Feb 25 15:15:09 2016
Snapshot name:asfsdb_snap04
RO Snapshot or RW snapshot:rw
Parent Name:/MNT/ACFS
Snapshot creation Time:thu Feb 25 15:15:33 2016
Number of Snapshots:4
Snapshot Space usage:2430095360
[Oracle@ol6-121-rac1 ~]$
[Oracle@ol6-121-rac1 ~]$ acfsutil Info fs/mnt/acfs
/mnt/acfs
ACFS version:12.1.0.1.0
Flags:mountpoint,available
Mount Time:thu Feb 25 13:37:36 2016
Volumes:1
Total size:8388608000
Total free:3935641600
Primary Volume:/dev/asm/vol1-28
Label
Flags:primary,available,advm
On-disk version:43.0
Allocation unit:4096
Major, minor:251, 14337
size:8388608000
free:3935641600
ADVM DiskGroup Dg_acfs
ADVM Resize increment:33554432
ADVM redundancy:unprotected
ADVM Stripe columns:4
ADVM Stripe width:131072
Number of Snapshots:4 <<<< has 4 snapshot
Snapshot space usage:2430095360 <<<<<< 4 snapshot, spaces only use 2.4G. Although the size of a set of data files is more than 1 G.
Replication status:disabled
[Oracle@ol6-121-rac1 ~]$
Acfs's snapshot function is powerful, not only to establish read-only, read-write, but also to convert between read-only and read and write, in addition, can also build snapshot-of-snapshot, You specify the parent snapshot on Acfsutil when you add the-p parameter.
V. Use the snapshot generated above to pull up another database on Node 2.
25. First create a pfile on Node 2 that can be copied from node 1, but there are some areas that need to be modified:
[Oracle@ol6-121-rac2 dbs]$ cat Initacfsdb.ora
*.audit_file_dest= '/u01/app/oracle/admin/acfsdb/adump '
*. Audit_trail= ' db '
*.compatible= ' 12.1.0.0.0 '
*.control_files= '/mnt/acfs/. Acfs/snaps/asfsdb_snap01/oradata/acfsdb/control01.ctl ', '/mnt/acfs/. Acfs/snaps/asfsdb_snap01/oradata/acfsdb/control02.ctl ' <<<<<<< Modify the path here to the path of snapshot
*.db_ block_size=8192
*.db_domain= '
*.db_name= ' acfsdb '
*.db_unique_name= ' Cowacfs ' <<<<<< < This must be added db_unique_name, otherwise the OCSSD process will detect the presence of 2 instance, the error instance_number busy
*.diagnostic_dest= '/u01/app/ Oracle '
*.dispatchers= ' (protocol=tcp) (service=acfsdbxdb) '
#*.local_listener= ' listener_acfsdb ' << <<<< Modify here
*.memory_target=1160m
*.open_cursors=300
*.processes=300
*.remote_login_ Passwordfile= ' EXCLUSIVE '
*.undo_tablespace= ' UNDOTBS1 '
Remember that you have to add db_unique_name, otherwise, in a cluster environment, even if you have Srvctl Remove to the database information, but add the same instance time, still will complain:
Sql> Startup Nomount
Ora-00304:requested Instance_number is busy
Sql> exit
Must be solved by db_unique_name.
26. At this point, the snapshot should be started with read-write (RW), if it is read only snapshot, can not boot to mount, because the file is read-only. In Alertlog, you will see the following error:
Thu Feb 25 13:44:12 2016
ALTER DATABASE Mount
Thu Feb 25 13:44:17 2016
Errors in FILE/U01/APP/ORACLE/DIAG/RDBMS/COWACFS/ACFSDB/TRACE/ACFSDB_ORA_11237.TRC:
Ora-00206:error in writing (blocks 1, # blocks 1) of control file
Ora-00202:control file: '/mnt/acfs/. Acfs/snaps/asfsdb_snap01/oradata/acfsdb/control01.ctl '
Ora-27041:unable to open File
Linux-x86_64 Error:13:permission denied
Additional Information:3
ORA-221 signalled During:alter database mount ...
27. Need to use the read and write that snapshot to start, we use the fourth snapshot to start on Node 2:
Note, at this time pfile control file has been changed to become the asfsdb_snap04 of that.
[Oracle@ol6-121-rac2 dbs]$ sqlplus "/As SYSDBA"
sql*plus:release 12.1.0.1.0 Production on Thu Feb 25 1 5:18:41 2016
Copyright (c) 1982, 2013, oracle. All rights reserved.
Connected to a ID Le instance.
sql> startup Nomount
ORACLE instance started.
Total System Global area 1219260416 by TES
Fixed size 2287768 bytes
Variable size 855639912 bytes
Database buffers 352321536 bytes
Redo buffers 9011200 bytes
Sql> ALTER DATABASE Mount
2 /
database altered.
&NBSP ;
28. After booting to mount, we will control the file path information in the file and change to the ACFSDB_SNAP04 path:
Check the current path first
Sql> select name from V$datafile
2 UNION ALL
3 Select name from V$tempfile
4 UNION ALL
5 Select member from V$logfile;
NAME
--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------
/mnt/acfs/oradata/acfsdb/system01.dbf
/mnt/acfs/oradata/acfsdb/sysaux01.dbf
/mnt/acfs/oradata/acfsdb/undotbs01.dbf
/mnt/acfs/oradata/acfsdb/users01.dbf
/mnt/acfs/oradata/acfsdb/temp01.dbf
/mnt/acfs/oradata/acfsdb/redo01.log
/mnt/acfs/oradata/acfsdb/redo02.log
/mnt/acfs/oradata/acfsdb/redo03.log
8 rows selected.
Generate Modify Script
SELECT DISTINCT ' ALTER DATABASE rename file ' | | | a.name| | | ' To ' | | | substr (C.name,1,instr (c.name, '/',-1)) | | substr (A.name,instr (A.name, '/', -1) +1) | | | ' from v$controlfile C, v$datafile a
UNION ALL
SELECT DISTINCT ' ALTER DATABASE rename file ' | | | b.name| | | ' To ' | | | substr (C.name,1,instr (c.name, '/',-1)) | | substr (B.name,instr (b.name, '/', -1) +1) | | | ' from v$controlfile C, V$tempfile b
UNION ALL
SELECT DISTINCT ' ALTER DATABASE rename file ' | | | d.member| | | ' To ' | | | substr (C.name,1,instr (c.name, '/',-1)) | | substr (D.member,instr (D.member, '/', -1) +1) | | | ' from v$controlfile c, V$logfile D;
Execute the statement above that modifies the script generated:
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/sysaux01.dbf ' to '/mnt/acfs/. ACFS/SNAPS/ASFSDB_SNAP04/ORADATA/ACFSDB/SYSAUX01.DBF ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/system01.dbf ' to '/mnt/acfs/. ACFS/SNAPS/ASFSDB_SNAP04/ORADATA/ACFSDB/SYSTEM01.DBF ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/undotbs01.dbf ' to '/mnt/acfs/. ACFS/SNAPS/ASFSDB_SNAP04/ORADATA/ACFSDB/UNDOTBS01.DBF ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/users01.dbf ' to '/mnt/acfs/. ACFS/SNAPS/ASFSDB_SNAP04/ORADATA/ACFSDB/USERS01.DBF ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/temp01.dbf ' to '/mnt/acfs/. ACFS/SNAPS/ASFSDB_SNAP04/ORADATA/ACFSDB/TEMP01.DBF ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/redo01.log ' to '/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/redo01.log ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/redo02.log ' to '/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/redo02.log ';
Alter DATABASE rename file '/mnt/acfs/oradata/acfsdb/redo03.log ' to '/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/redo03.log ';
Database altered.
Sql>
Database altered.
Sql>
Database altered.
Sql>
Database altered.
Sql>
Database altered.
Sql>
Database altered.
Sql>
Database altered.
Sql>
Database altered.
Check for modified results:
Sql> select name from V$datafile
2 UNION ALL
3 Select name from V$tempfile
4 UNION ALL
5 Select member from V$logfile;
NAME
--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/system01.dbf
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/sysaux01.dbf
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/undotbs01.dbf
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/users01.dbf
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/temp01.dbf
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/redo01.log
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/redo02.log
/mnt/acfs/. Acfs/snaps/asfsdb_snap04/oradata/acfsdb/redo03.log
8 rows selected.
To open a database:
sql> ALTER DATABASE open;
Database altered.
Sql>
Sql> Select Max (To_char (mydate, ' Yyyy-mm-dd hh24:mi:ss ') from T1;
MAX (To_char (MyDate,
-------------------
2016-02-25 15:15:33
Sql>
As you can see, I do snapsnot on one side, while doing DML insert Sysdate, the last record of the recovered T1 table is 15:15:33, and also my snapshot creation time:
Snapshot name:asfsdb_snap04
RO Snapshot or RW snapshot:rw
Parent Name:/MNT/ACFS
Snapshot creation Time:thu Feb 25 15:15:33 2016
Finally, again, although we can snapshot the main library, to do the cow library, but a better way is to dataguard the disaster preparedness of the database to do snapshot, so as to brush out a cow library. This is also copy-on-write and has no effect on the main library. Make the architecture diagram as follows: