【参考大话rac】
查询linux版本,下载对应的asmlib
[
oracle@localhost tmp]$ rpm -ivh oracleasm
oracleasm-2.6.18-348.el5-2.0.5-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-support-2.1.8-1.el5.x86_64.rpm
配置oracleasm
[
root@localhost tmp]# /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
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 tmp]#
创建asmdisk物理
添加css服务【root添加】
[
root@localhost /]# /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)
启动asm实例
[
oracle@localhost ~]$
[
oracle@localhost ~]$ mkdir -p $ORACLE_BASE/admin/+ASM/udump
[
oracle@localhost ~]$ mkdir -p $ORACLE_BASE/admin/+ASM/bdump
[
oracle@localhost ~]$ mkdir -p $ORACLE_BASE/admin/+ASM/cdump
[
oracle@localhost ~]$
[oracle@localhost ~]$ ls
asmpfile.ora awrinfo.txt awrrpt_1_8_9.html orapw+ASM sp_1_11.lst
[oracle@localhost ~]$
[
oracle@localhost ~]$ vi asmpfile.ora
instance_type=asm
large_pool_size=12M
remote_login_passwordfile=exclusive
asm_diskstring=' DB:VOL*'
background_dump_dest=/u01/app/oracle/admin/+ASM/bdump
core_dump_dest=/u01/app/oracle/admin/+ASM/cdump
user_dump_dest=/u01/app/oracle/admin/+ASM/udump
~
"asmpfile.ora" 8L, 252C written
[
oracle@localhost ~]$ export ORACLE_SID=+ASM
[
oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 3 15:06:10 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile=/home/oracle/asmpfile.ora
ASM instance started
Total System Global Area 130023424 bytes
Fixed Size 2019032 bytes
Variable Size 102838568 bytes
ASM Cache 25165824 bytes
ORA-15110: no diskgroups mounted
创建diskgroup逻辑
SQL> create diskgroup dg1 external redundancy disk 'ORCL:VOL1' ;
SQL>
SQL> create spfile from pfile='/home/oracle/asmpfile.ora';
SQL>
备份rdbms,建议开启归档
[
oracle@localhost ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Fri Feb 3 15:22:09 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: DB (DBID=1612005818)
RMAN> run {backup as copy database format '+DG1';}
Starting backup at 03-FEB-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=150 devtype=DISK
channel ORA_DISK_1: starting datafile copy
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/03/2012 15:22:48
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting datafile copy
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 02/03/2012 15:22:48
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
continuing other job steps, job failed will not be re-run
……
RMAN> shutdown immediate
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount;
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 285212672 bytes
Fixed Size 2020224 bytes
Variable Size 117443712 bytes
Database Buffers 163577856 bytes
Redo Buffers 2170880 bytes
RMAN> run {backup as copy database format '+DG1';}
Starting backup at 03-FEB-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/oradata/db/system01.dbf
output filename=+DG1/db/datafile/system.258.774285885 tag=TAG20120203T152437 recid=3 stamp=774285954
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:26
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/u01/oradata/db/sysaux01.dbf
output filename=+DG1/db/datafile/sysaux.259.774285963 tag=TAG20120203T152437 recid=4 stamp=774286020
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting datafile copy
……
修改rdbms参数
SQL>
SQL> alter system set db_recovery_file_dest='+DG1' scope=both;
SQL> alter system set db_recovery_file_dest_size=5g scope=both;
SQL> alter system set db_create_file_dest='+DG1' scope=both;
SQL> alter system set db_create_online_log_dest_1='+DG1' scope=both;
SQL>
采用添加后删除源文件的方式变更redolog、temp
SQL> alter database add logfile member '+DG1' to group 1;
SQL> alter system switch logfile;
SQL> alter database drop logfile member '/u01/oradata/db/redo01.log';
SQL> alter database drop logfile group 4;
SQL> alter database drop standby logfile group 4;
SQL> alter database add standby logfile group 4 size 50m;
SQL> alter tablespace temp add tempfile size 5m;
SQL> alter database tempfile '/u01/oradata/db/tempfile01.dbf' drop;
修改controlfile到asm
SQL> show parameter control_files
SQL> alter system set control_files='+DG1/db/controlfile/control01','+DG1/db/controlfile/control02','+DG1/db/controlfile/control03' scope=spfile;
rman恢复
startup nomount
RMAN> restore controlfile from '/u01/oradata/db/control01.ctl';
Starting restore at 03-FEB-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=+DG1/db/controlfile/control01
output filename=+DG1/db/controlfile/control02
output filename=+DG1/db/controlfile/control03
Finished restore at 03-FEB-12
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> switch database to copy;
datafile 1 switched to datafile copy "+DG1/db/datafile/system.258.774285885"
datafile 2 switched to datafile copy "+DG1/db/datafile/undotbs1.262.774286133"
datafile 3 switched to datafile copy "+DG1/db/datafile/sysaux.259.774285963"
datafile 4 switched to datafile copy "+DG1/db/datafile/users.260.774286029"
datafile 5 switched to datafile copy "+DG1/db/datafile/example.261.774286077"
datafile 6 switched to datafile copy "+DG1/db/datafile/test.266.774286153"
datafile 7 switched to datafile copy "+DG1/db/datafile/users1.264.774286151"
datafile 8 switched to datafile copy "+DG1/db/datafile/users1.263.774286149"
RMAN> recover database;
Starting recover at 03-FEB-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
starting media recovery
unable to find archive log
archive log thread=1 sequence=28
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 02/03/2012 16:09:22
RMAN-06054: media recovery requesting unknown log: thread 1 seq 28 lowscn 1006283
SQL>
SQL> RECOVER DATABASE UNTIL CANCEL;
ORA-00279: change 1006283 generated at 02/03/2012 15:23:23 needed for thread 1
ORA-00289: suggestion :
/u01/flash_recovery_area/DB/archivelog/2012_02_03/o1_mf_1_28_%u_.arc
ORA-00280: change 1006283 for thread 1 is in sequence #28
Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.
SQL>
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL>
SQL> alter database open resetlogs;
Database altered.
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21699095/viewspace-1307115/
,如需转载,请注明出处,否则将追究法律责任。