oracle fs to asm 操作测试

[root@localhost ~]# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         127     1020096   83  Linux
/dev/sda2             128         318     1534207+  82  Linux swap
/dev/sda3             319        1566    10024560   83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table
[root@localhost ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): +2048m

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (251-1305, default 251):
Using default value 251
Last cylinder or +size or +sizeM or +sizeK (251-1305, default 1305): +2048m

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (501-1305, default 501):
Using default value 501
Last cylinder or +size or +sizeM or +sizeK (501-1305, default 1305): +2048m

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Selected partition 4
First cylinder (751-1305, default 751):
Using default value 751
Last cylinder or +size or +sizeM or +sizeK (751-1305, default 1305): +2048m

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# partprobe
[root@localhost ~]# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         127     1020096   83  Linux
/dev/sda2             128         318     1534207+  82  Linux swap
/dev/sda3             319        1566    10024560   83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         250     2008093+  83  Linux
/dev/sdb2             251         500     2008125   83  Linux
/dev/sdb3             501         750     2008125   83  Linux
/dev/sdb4             751        1000     2008125   83  Linux
[root@localhost ~]#


[root@localhost asm]# cd /root/asm
[root@localhost asm]# ls
oracleasm-2.6.9-78.EL-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-78.EL-debuginfo-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-78.ELhugemem-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
oracleasm-2.6.9-78.ELxenU-2.0.5-1.el4.i686.rpm
oracleasmlib-2.0.4-1.el4.i386.rpm
oracleasm-support-2.1.4-1.el4.i386.rpm
[root@localhost asm]# rpm -ivh oracleasm-support-2.1.4-1.el4.i386.rpm
warning: oracleasm-support-2.1.4-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1racleasm-support      ########################################### [100%]
[root@localhost asm]# rpm -ivh oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm
warning: oracleasm-2.6.9-78.ELsmp-2.0.5-1.el4.i686.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1racleasm-2.6.9-78.ELsm########################################### [100%]
[root@localhost asm]# rpm -ivh oracleasmlib-2.0.4-1.el4.i386.rpm
warning: oracleasmlib-2.0.4-1.el4.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing...                ########################################### [100%]
   1racleasmlib           ########################################### [100%]
[root@localhost asm]#

[root@localhost asm]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: oracle
Default group to own the driver interface []: DBA
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@localhost asm]# fdisk -l

Disk /dev/sda: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         127     1020096   83  Linux
/dev/sda2             128         318     1534207+  82  Linux swap
/dev/sda3             319        1566    10024560   83  Linux

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         250     2008093+  83  Linux
/dev/sdb2             251         500     2008125   83  Linux
/dev/sdb3             501         750     2008125   83  Linux
/dev/sdb4             751        1000     2008125   83  Linux
[root@localhost asm]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
Marking disk "VOL1" as an ASM disk:                        [  OK  ]
[root@localhost asm]# /etc/init.d/oracleasm createdisk VOL2 /dev/sdb2
Marking disk "VOL2" as an ASM disk:                        [  OK  ]
[root@localhost asm]# /etc/init.d/oracleasm createdisk VOL3 /dev/sdb3
Marking disk "VOL3" as an ASM disk:                        [  OK  ]
[root@localhost asm]# /etc/init.d/oracleasm createdisk VOL4 /dev/sdb4
Marking disk "VOL4" as an ASM disk:                        [  OK  ]
[root@localhost asm]# /etc/init.d/oracleasm scandisk
Usage: /etc/init.d/oracleasm {start|stop|restart|enable|disable|configure|createdisk|deletedisk|querydisk|listdisks|scandisks|status}
[root@localhost asm]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@localhost asm]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
[root@localhost bin]# pwd
/u01/app/oracle/product/10.2.0/db_1/bin
[root@localhost bin]# /u01/app/oracle/product/10.2.0/db_1/bin localconfig add
bash: /u01/app/oracle/product/10.2.0/db_1/bin: is a directory
[root@localhost bin]# /u01/app/oracle/product/10.2.0/db_1/bin/localconfig add
/etc/oracle does not exist. Creating it now.
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 90 seconds.
Checking the status of new Oracle init process...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
        localhost
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@localhost bin]# ps -ef | grep css
root     10845     1  0 22:32 ?        00:00:00 /bin/su -l oracle -c sh -c 'cd /u01/app/oracle/product/10.2.0/db_1/log/localhost/cssd;  ulimit -c unlimited; exec /u01/app/oracle/product/10.2.0/db_1/bin/ocssd '
oracle   10956 10845  0 22:33 ?        00:00:00 /u01/app/oracle/product/10.2.0/db_1/bin/ocssd.bin
root     11013  8437  0 22:33 pts/1    00:00:00 grep css

[root@localhost asm]# su - oracle
[oracle@localhost ~]$ pwd
/home/oracle
[oracle@localhost ~]$ vi initasm+.ora
[oracle@localhost ~]$ more initasm+.ora
INSTANCE_TYPE=ASM
ASM_POWER_LIMIT=3
ASM_DISKSTRING='ORCL:VOL*'
ASM_DISKGROUPS=DATA,RECOVERY,DGLOG1,DGLOG2

[root@localhost bin]# su - oracle
[oracle@localhost ~]$ ls
database  initasm+.ora
[oracle@localhost ~]$ export ORACLE_SID=+ASM
[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jun 27 22:38:22 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect /as sysdba
Connected to an idle instance.
SQL> startup pfile='/home/oracle/initasm+.ora';
ASM instance started

Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"RECOVERY"
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"DGLOG2"
ORA-15063: ASM discovered an insufficient number of disks for diskgroup
"DGLOG1"
ORA-15063: ASM discovered an insufficient number of disks for diskgroup "DATA"


SQL>
SQL> create diskgroup DATA external redundancy disk 'ORCL:VOL1';

Diskgroup created.

SQL> create diskgroup RECOVERY external redundancy disk 'ORCL:VOL2';

Diskgroup created.

SQL> create diskgroup DGLOG1 external redundancy disk 'ORCL:VOL3';

Diskgroup created.

SQL> create diskgroup DGLOG2 external redundancy disk 'ORCL:VOL4';

Diskgroup created.

SQL> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup pfile='/home/oracle/initasm+.ora';
ASM instance started

Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> select group_number,name,state,type
  2  from v$asm_diskgroup;

GROUP_NUMBER NAME                           STATE       TYPE
------------ ------------------------------ ----------- ------
           1 DATA                           MOUNTED     EXTERN
           2 DGLOG1                         MOUNTED     EXTERN
           3 DGLOG2                         MOUNTED     EXTERN
           4 RECOVERY                       MOUNTED     EXTERN

SQL>

SQL> host cp /home/oracle/initasm+.ora /u01/app/oracle/product/10.2.0/db_1/dbs/init+ASM.ora;

SQL> create spfile from pfile;

File created.

SQL> shutdown immediate;
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL>



[root@localhost ~]# su - oracle
[oracle@localhost ~]$ export ORACLE_SID=orcl
[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jun 27 22:51:25 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> connect /as sysdba
Connected.
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/10.2.0
                                                 /db_1/dbs/spfileorcl.ora
SQL> host;
[oracle@localhost ~]$ pwd
/home/oracle
[oracle@localhost ~]$ exit
exit

SQL> select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

SQL> select name from v$database;

NAME
---------
ORCL

SQL> alter system set db_create_file_dest='+DATA' scope=both;

System altered.

SQL> alter system set db_recovery_file_dest='+RECOVERY' scope=both;

System altered.

SQL> alter system set db_recovery_file_dest_size=2g;

System altered.

SQL> alter system set db_create_online_log_dest_1='+DGLOG1' scope=both;

System altered.

SQL> alter system set db_create_online_log_dst_2='+DGLOG2' scope=both;
alter system set db_create_online_log_dst_2='+DGLOG2' scope=both
                 *
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM


SQL> c/dst/dest
  1* alter system set db_create_online_log_dest_2='+DGLOG2' scope=both
SQL> r
  1* alter system set db_create_online_log_dest_2='+DGLOG2' scope=both

System altered.

SQL>

*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/oradata/orcl/control02.ctl','/u01/app/oracle/oradata/orcl/control03.ctl'


SQL> create pfile='/home/oracle/initorcl.ora' from spfile;

File created.

SQL> host;
[oracle@localhost ~]$ ls
database  initasm+.ora  initorcl.ora
[oracle@localhost ~]$ vi initorcl.ora
[oracle@localhost ~]$ exit
exit

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

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              75499764 bytes
Database Buffers           88080384 bytes
Redo Buffers                2973696 bytes
SQL> shutdown immediate;
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> create spfile from pfile='/home/oracle/initorcl.ora';

File created.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              79694068 bytes
Database Buffers           83886080 bytes
Redo Buffers                2973696 bytes
SQL> host;
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jun 27 23:03:00 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: orcl (not mounted)

RMAN> restore controlfile from '/u01/app/oracle/oradata/orcl/control01.ctl';

Starting restore at 27-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK

channel ORA_DISK_1: copied control file copy
output filename=+DGLOG1/orcl/controlfile/backup.256.787100655
output filename=+DGLOG2/orcl/controlfile/backup.256.787100657
Finished restore at 27-JUN-12

RMAN>
RMAN> exit


Recovery Manager complete.
[oracle@localhost ~]$ exit
exit

SQL> alter database mount;

Database altered.

SQL> host;
[oracle@localhost ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Jun 27 23:06:38 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL (DBID=1314875880, not open)

RMAN> backup as copy database format '+DATA';

Starting backup at 27-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=157 devtype=DISK
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
output filename=+DATA/orcl/datafile/system.256.787100833 tag=TAG20120627T230712 recid=2 stamp=787100904
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
output filename=+DATA/orcl/datafile/sysaux.257.787100909 tag=TAG20120627T230712 recid=3 stamp=787100938
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
output filename=+DATA/orcl/datafile/example.258.787100943 tag=TAG20120627T230712 recid=4 stamp=787100953
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
output filename=+DATA/orcl/datafile/undotbs1.259.787100959 tag=TAG20120627T230712 recid=5 stamp=787100963
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
output filename=+DATA/orcl/datafile/users.260.787100965 tag=TAG20120627T230712 recid=6 stamp=787100966
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+DATA/orcl/controlfile/backup.261.787100967 tag=TAG20120627T230712 recid=7 stamp=787100968
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 27-JUN-12
channel ORA_DISK_1: finished piece 1 at 27-JUN-12
piece handle=+DATA/orcl/backupset/2012_06_27/nnsnf0_tag20120627t230712_0.262.787100975 tag=TAG20120627T230712 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 27-JUN-12

RMAN> switch database to copy;

datafile 1 switched to datafile copy "+DATA/orcl/datafile/system.256.787100833"
datafile 2 switched to datafile copy "+DATA/orcl/datafile/undotbs1.259.787100959"
datafile 3 switched to datafile copy "+DATA/orcl/datafile/sysaux.257.787100909"
datafile 4 switched to datafile copy "+DATA/orcl/datafile/users.260.787100965"
datafile 5 switched to datafile copy "+DATA/orcl/datafile/example.258.787100943"
RMAN> sql'alter database open';

sql statement: alter database open

RMAN>
RMAN> exit


Recovery Manager complete.
[oracle@localhost ~]$ exit
exit


SQL> alter database add logfile member '+DGLOG1','+DGLOG2' to group 1;

Database altered.

SQL> alter database add logfile member '+DGLOG1','+DGLOG2' to group 2;

Database altered.

SQL> alter database add logfile member '+DGLOG1','+DGLOG2' to group 3

Database altered.

SQL> col member for a50;
SQL> set line 120
SQL> select group#,member,status,type
  2  from v$logfile;

    GROUP# MEMBER                                             STATUS  TYPE
---------- -------------------------------------------------- ------- -------
         3 /u01/app/oracle/oradata/orcl/redo03.log                    ONLINE
         2 /u01/app/oracle/oradata/orcl/redo02.log                    ONLINE
         1 /u01/app/oracle/oradata/orcl/redo01.log                    ONLINE
         1 +DGLOG1/orcl/onlinelog/group_1.257.787101819       INVALID ONLINE
         1 +DGLOG2/orcl/onlinelog/group_1.257.787101821       INVALID ONLINE
         2 +DGLOG1/orcl/onlinelog/group_2.258.787101839       INVALID ONLINE
         2 +DGLOG2/orcl/onlinelog/group_2.258.787101841       INVALID ONLINE
         3 +DGLOG1/orcl/onlinelog/group_3.259.787102979       INVALID ONLINE     
         3 +DGLOG2/orcl/onlinelog/group_3.259.787102979       INVALID ONLINE        
9 rows selected.



SQL> alter system switch logfile;

System altered.

SQL> r
  1* alter system switch logfile

System altered.

SQL> r
  1* alter system switch logfile

System altered.


SQL> select members,status from v$log;

   MEMBERS STATUS
---------- ----------------
         3 INACTIVE
         3 CURRENT
         1 INACTIVE

SQL> r
  1* select members,status from v$log

   MEMBERS STATUS
---------- ----------------
         3 INACTIVE
         3 CURRENT
         1 INACTIVE

SQL> alter database drop logfile member '/u01/app/oracle/oradata/orcl/redo01.log';

Database altered.



SQL> select members,status from v$log;

   MEMBERS STATUS
---------- ----------------
         2 INACTIVE
         3 CURRENT
         1 INACTIVE



SQL> select members,status from v$log;

   MEMBERS STATUS
---------- ----------------
         2 INACTIVE
         3 CURRENT
         1 INACTIVE



SQL> alter system switch logfile;

System altered.



SQL> r
  1*  select members,status from v$log

   MEMBERS STATUS
---------- ----------------
         2 INACTIVE
         3 ACTIVE
         1 CURRENT

SQL>
SQL> alter database drop logfile member '/u01/app/oracle/oradata/orcl/redo02.log';

Database altered.


SQL> alter system switch logfile;

System altered.



SQL> alter system switch logfile;

System altered.

SQL> r
  1* alter system switch logfile

System altered.

SQL> select group#,member,status,type from v$logfile;

    GROUP# MEMBER                                             STATUS  TYPE
---------- -------------------------------------------------- ------- -------
         3 /u01/app/oracle/oradata/orcl/redo03.log                    ONLINE
         3 +DGLOG1/orcl/onlinelog/group_3.259.787102979               ONLINE
         3 +DGLOG2/orcl/onlinelog/group_3.259.787102979               ONLINE
         1 +DGLOG1/orcl/onlinelog/group_1.257.787101819               ONLINE
         1 +DGLOG2/orcl/onlinelog/group_1.257.787101821               ONLINE
         2 +DGLOG1/orcl/onlinelog/group_2.258.787101839               ONLINE
         2 +DGLOG2/orcl/onlinelog/group_2.258.787101841               ONLINE

7 rows selected.

SQL> select members,status from v$log;

   MEMBERS STATUS
---------- ----------------
         2 ACTIVE
         2 ACTIVE
         3 CURRENT

SQL> alter system switch logfile;

System altered.

SQL> select members,status from v$log;

   MEMBERS STATUS
---------- ----------------
         2 CURRENT
         2 ACTIVE
         3 ACTIVE

SQL> alter system checkpoint;

System altered.

SQL> select members,status from v$log;

   MEMBERS STATUS
---------- ----------------
         2 CURRENT
         2 INACTIVE
         3 INACTIVE

SQL> alter database drop logfile member '/u01/app/oracle/oradata/orcl/redo03.log';

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> select group#,member,status,type from v$logfile;

    GROUP# MEMBER                                             STATUS  TYPE
---------- -------------------------------------------------- ------- -------
         3 +DGLOG1/orcl/onlinelog/group_3.259.787102979               ONLINE
         3 +DGLOG2/orcl/onlinelog/group_3.259.787102979               ONLINE
         1 +DGLOG1/orcl/onlinelog/group_1.257.787101819               ONLINE
         1 +DGLOG2/orcl/onlinelog/group_1.257.787101821               ONLINE
         2 +DGLOG1/orcl/onlinelog/group_2.258.787101839               ONLINE
         2 +DGLOG2/orcl/onlinelog/group_2.258.787101841               ONLINE

6 rows selected.

SQL>

SQL> col name for a50;
SQL> select ts#,name from v$tempfile;

       TS# NAME
---------- --------------------------------------------------
         3 /u01/app/oracle/oradata/orcl/temp01.dbf

SQL> select ts#,name from v$tablespace where ts#=3;

       TS# NAME
---------- --------------------------------------------------
         3 TEMP

SQL> alter tablespace temp add tempfile size 500m;

Tablespace altered.

SQL> alter database tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' drop;

Database altered.

SQL>  select ts#,name from v$tempfile;

       TS# NAME
---------- --------------------------------------------------
         3 +DATA/orcl/tempfile/temp.263.787103349


SQL> select file_name from dba_data_files;

FILE_NAME
------------------------------------------------------------------------------------------------------------------------
+DATA/orcl/datafile/users.260.787100965
+DATA/orcl/datafile/sysaux.257.787100909
+DATA/orcl/datafile/undotbs1.259.787100959
+DATA/orcl/datafile/system.256.787100833
+DATA/orcl/datafile/example.258.787100943

SQL> col name for a50;
SQL> select ts#,name from v$tempfile;

       TS# NAME
---------- --------------------------------------------------
         3 /u01/app/oracle/oradata/orcl/temp01.dbf

SQL> select ts#,name from v$tablespace where ts#=3;

       TS# NAME
---------- --------------------------------------------------
         3 TEMP

SQL> alter tablespace temp add tempfile size 500m;

Tablespace altered.

SQL> alter database tempfile '/u01/app/oracle/oradata/orcl/temp01.dbf' drop;

Database altered.

SQL>  select ts#,name from v$tempfile;

       TS# NAME
---------- --------------------------------------------------
         3 +DATA/orcl/tempfile/temp.263.787103349

SQL> select file_name from dba_data_files;

FILE_NAME
------------------------------------------------------------------------------------------------------------------------
+DATA/orcl/datafile/users.260.787100965
+DATA/orcl/datafile/sysaux.257.787100909
+DATA/orcl/datafile/undotbs1.259.787100959
+DATA/orcl/datafile/system.256.787100833
+DATA/orcl/datafile/example.258.787100943

SQL> select open_mode from v$database;

OPEN_MODE
----------
READ WRITE

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     10
Next log sequence to archive   12
Current log sequence           12
SQL> show parameter db_recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      +RECOVERY
db_recovery_file_dest_size           big integer 2G
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              79694068 bytes
Database Buffers           83886080 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> show parameter db

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_16k_cache_size                    big integer 0
db_2k_cache_size                     big integer 0
db_32k_cache_size                    big integer 0
db_4k_cache_size                     big integer 0
db_8k_cache_size                     big integer 0
db_block_buffers                     integer     0
db_block_checking                    string      FALSE
db_block_checksum                    string      TRUE
db_block_size                        integer     8192
db_cache_advice                      string      ON
db_cache_size                        big integer 0

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string      +DATA
db_create_online_log_dest_1          string      +DGLOG1
db_create_online_log_dest_2          string      +DGLOG2
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string
db_domain                            string
db_file_multiblock_read_count        integer     16
db_file_name_convert                 string
db_files                             integer     200
db_flashback_retention_target        integer     1440

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_keep_cache_size                   big integer 0
db_name                              string      orcl
db_recovery_file_dest                string      +RECOVERY
db_recovery_file_dest_size           big integer 2G
db_recycle_cache_size                big integer 0
db_unique_name                       string      orcl
db_writer_processes                  integer     1
dbwr_io_slaves                       integer     0
rdbms_server_dn                      string
standby_archive_dest                 string      ?/dbs/arch
standby_file_management              string      MANUAL
SQL> show parameter log_archive_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_1             string      enable
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
SQL> alter system set standby_archive_dest='+RECOVERY' scope=both;

System altered.

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

Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              79694068 bytes
Database Buffers           83886080 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL>









标签: 暂无标签
dongxujian

写了 86 篇文章,拥有财富 384,被 13 人关注

转播转播 分享分享 分享淘帖
回复

使用道具

成为第一个吐槽的人

您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

意见
反馈