oracle单实例 ASM归档变更


#asmcmd这个东西非常好,简化了管理员对于ASM相关的操作

#ASM实例开启归档
ASM开启归档与普通的一样,只是归档日志的目录需要变化。
1.先查询好准备的归档日志的挂载点目录
ASMCMD> pwd
+DISKGROUP2/TEST/ARCH

2.更改命令
alter system set log_archive_dest_1=’LOCATION=+DISKGROUP2/ARCH’ scope=spfile

3.更改归档
SQL> alter system set log_archive_dest_1=’LOCATION=+DISKGROUP2/ARCH’ scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1267044 bytes
Variable Size 109054620 bytes
Database Buffers 167772160 bytes
Redo Buffers 7118848 bytes
Database mounted.

SQL> alter database open;

Database altered.

SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DISKGROUP2/test/arch
Oldest online log sequence 16
Next log sequence to archive 18
Current log sequence 18

//手工归档一次
SQL> alter system archive log current;

System altered.

//查看一下归档的效果,在+DISKGROUP2/ARCH下面有了手工归档出来的归档日志文件
ASMCMD> pwd
+DISKGROUP2/ARCH
ASMCMD> ls
1_19_740941867.dbf

//如果你在配置磁盘的时候配置了冗余,那么你会在如下目录找到一个备份,Redund便是冗余的提示信息,通常情况下会在磁盘组中创建如下
//的缺省目录,+$DISKGROUP_NAME/ORACLE_SID/ARCHIVELOG,当然如果你创建了一个数据文件,在平级的目录中也会出现DATAFILE的关键字目录,与
//ARCHIVELOG平级
ASMCMD> pwd
+DISKGROUP2/TEST/ARCHIVELOG/2011_01_28
ASMCMD> ls -lrt
Type Redund Striped Time Sys Name
ARCHIVELOG MIRROR COARSE JAN 28 13:00:00 Y thread_1_seq_18.258.741619145
ARCHIVELOG MIRROR COARSE JAN 28 13:00:00 Y thread_1_seq_19.259.741619671

ASMCMD> pwd
+DISKGROUP2/TEST
ASMCMD> ls
ARCH/
ARCHIVELOG/
DATAFILE/

PS:dba_extents是个不错的东西,dba可以用它查询某个用户对象的磁盘占用开销情况

SQL> select owner,segment_name,bytes from dba_extents where owner=’SCOTT’;

OWNER SEGMENT_NAME BYTES
—————————— —————————— ———-
SCOTT DEPT 65536
SCOTT EMP 65536
SCOTT BONUS 65536
SCOTT SALGRADE 65536
SCOTT PK_DEPT 65536
SCOTT PK_EMP 65536