- 浏览: 243445 次
最新评论
目的:将oracle数据库的SID由原来的egmas改名为pams,所有涉及sid的部分都会修改过来。
备注:下面的例子是在ASM自动存储管理下实现的,同样也适用于文件系统。
1、创建pfile
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA_DG/egmas/spfileegmas.ora
SQL> create pfile='/tmp/pfileegmas.ora' from spfile;
File created.
shutdown immediate
[root@cnsz03pl0032 ~]# vi /etc/oratab
pams:/dba/oracle/product/11.2.0.3.0:N # line added by Agent
cnsz03pl0032:egmas > pwd
/dba/oracle/product/11.2.0.3.0/dbs
2、修改一些重要文件名
cnsz03pl0032:egmas > ls -l *egmas*
-rw-rw---- 1 oracle asmadmin 1544 Nov 29 14:31 hc_egmas.dat
-rw-r----- 1 oracle oinstall 40 Nov 21 16:31 initegmas.ora
-rw-r----- 1 oracle oinstall 1536 Nov 21 16:31 orapwegmas
-rw-r----- 1 oracle oinstall 9748480 Nov 21 20:04 snapcf_egmas.f
cnsz03pl0032:egmas > mv hc_egmas.dat hc_pams.dat
cnsz03pl0032:egmas > mv orapwegmas orapwpams
cnsz03pl0032:egmas > cp initegmas.ora initpams.ora
3、新建pams的adump目录
cnsz03pl0032:pams > cd $ORACLE_BASE/admin
cnsz03pl0032:pams > ll
total 84
drwxr-xr-x 3 oracle oinstall 4096 Sep 23 18:13 bamsst
drwxr-x--- 5 oracle oinstall 4096 Jul 13 02:30 bmpst
drwxr-x--- 5 oracle oinstall 4096 Jul 8 23:32 bspdbst
drwxr-x--- 5 oracle oinstall 4096 Jul 8 22:11 cmspst
drwxr-x--- 8 oracle oinstall 4096 Nov 1 16:40 ecsst
drwxr-x--- 5 oracle oinstall 4096 Nov 21 16:27 egmas
drwxr-x--- 5 oracle oinstall 4096 Jul 8 22:19 hncmspst
drwxr-xr-x 5 oracle oinstall 4096 Aug 9 09:37 hnsssst
drwxr-x--- 8 oracle oinstall 4096 Nov 21 14:26 iams
drwxr-x--- 5 oracle oinstall 4096 Jul 13 02:45 iiscst
drwxr-xr-x 8 oracle oinstall 4096 Oct 21 16:04 lscmst
drwxr-x--- 8 oracle oinstall 4096 Aug 30 17:50 omptest
drwxr-xr-x 8 oracle oinstall 4096 Oct 21 15:20 pamsst
drwxr-x--- 5 oracle oinstall 4096 Nov 13 14:36 rstdbst
drwxr-xr-x 3 oracle oinstall 4096 Jul 3 23:25 sfecpdb
drwxr-x--- 8 oracle oinstall 4096 Jul 9 07:32 sfgpsst
drwxr-x--- 5 oracle oinstall 4096 Oct 12 14:14 sfmpst
drwxr-xr-x 7 oracle oinstall 4096 Sep 24 14:22 sfossst
drwxr-x--- 5 oracle oinstall 4096 Jul 6 21:40 wbepinterfacest
drwxr-x--- 5 oracle oinstall 4096 Jul 4 23:53 wbepst
drwxr-x--- 5 oracle oinstall 4096 Jul 2 04:12 wqsdbst
cnsz03pl0032:pams > mkdir pams
cnsz03pl0032:pams > cd pams
cnsz03pl0032:pams > mkdir adump
4、修改参数文件
---重点修改db_unique_name为新的sid,但此时千万不要修改db_name,其他的也都该成新的sid即可。
cnsz03pl0032:pams > vi /tmp/pfileegmas.ora
pams.__db_cache_size=3439329280
pams.__java_pool_size=16777216
pams.__large_pool_size=16777216
pams.__oracle_base='/dba/oracle'#ORACLE_BASE set from environment
pams.__pga_aggregate_target=7063207936
pams.__sga_target=4294967296
pams.__shared_io_pool_size=0
pams.__shared_pool_size=788529152
pams.__streams_pool_size=0
*.archive_lag_target=900
*.audit_file_dest='/dba/oracle/admin/egmas/adump'
*.audit_sys_operations=TRUE
*.audit_trail='DB_EXTENDED'
*.compatible='11.2.0.0.0'
*.control_files='+DATA_DG/pams/controlfile/current.612.832798423'#Restore Controlfile
*.db_block_size=8192
*.db_cache_size=5368709120
*.db_create_file_dest='+DATA_DG'
*.db_domain=''
*.db_files=2000
*.db_keep_cache_size=1073741824
*.db_name='egmas' ---注意这里千万不要修改
*.db_unique_name='pams' --这里指定新的sid
*.db_recovery_file_dest='+FRA_DG'
*.db_recovery_file_dest_size=21474836480
*.db_unique_name='pams'
*.diagnostic_dest='/dba/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=pamsXDB)'
*.java_pool_size=83886080
*.large_pool_size=314572800
*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST'
*.log_archive_format='arch_%t_%s_%r.arc'
*.log_archive_max_processes=5
*.memory_target=0
*.open_cursors=300
*.pga_aggregate_target=2147483648
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.resource_limit=FALSE
*.resource_manager_plan=''
*.sessions=1105
*.sga_max_size=0
*.sga_target=0
*.shared_pool_size=1073741824
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
5、以新的db_unique_name 启动数据库到mount状态
SQL> startup mount pfile='/tmp/pfileegmas.ora';
ORACLE instance started.
Total System Global Area 7933816832 bytes
Fixed Size 2243872 bytes
Variable Size 1476395744 bytes
Database Buffers 6442450944 bytes
Redo Buffers 12726272 bytes
Database mounted.
6、此时我们新建日志组的话就会自动创建到+data_dg/pams下面
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA_DG/egmas/onlinelog/group_4.594.832094113
+DATA_DG/egmas/onlinelog/group_5.595.832094149
+DATA_DG/egmas/onlinelog/group_6.596.832094161
+DATA_DG/egmas/onlinelog/group_7.597.832094171
+DATA_DG/egmas/onlinelog/group_8.598.832094179
+DATA_DG/egmas/onlinelog/group_9.599.832094189
6 rows selected.
SQL> alter database add logfile group 10 '+DATA_DG' size 100m;
SQL> alter database add logfile group 11 '+DATA_DG' size 100m;
SQL> alter database add logfile group 12 '+DATA_DG' size 100m;
随便先建几组,后面改就可以了。
[grid@cnsz03pl0032 ~]$ asmcmd
ASMCMD> cd DATA_DG
ASMCMD> cd PAMS
ASMCMD> cd ONLINELOG
ASMCMD> ls
group_10.606.832793705
group_11.594.832793715
group_12.613.832793723
就可以看到了,使用命令SQL> select member from v$logfile; 也可以查到,之前的我们并不用删除。
7、复制数据文件。
RMAN> copy datafile '+DATA_DG/EGMAS/DATAFILE/AUD_DATA.591.832094553' to '+DATA_DG';
copy datafile '+DATA_DG/EGMAS/DATAFILE/
ASMCMD> ls
AUD_DATA.615.832794687
AUD_INDEX.607.832794761
DBADATA.608.832794821
SYSAUX.609.832794857
SYSTEM.610.832794891
UNDOTBS1.611.832794927
USERS.614.832794595
一样的操作,拷贝过来,虽然会报错,control有关,不用理会,数据文件可以拷贝过来了。
8、数据文件和日志文件都有了,下面是控制文件:
SQL> alter database backup controlfile to trace; 这里的会话千万不要退出
Database altered.
SQL> select * from v$diag_info;
INST_ID NAME
---------- ----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 Diag Enabled
TRUE
1 ADR Base
/dba/oracle
1 ADR Home
/dba/oracle/diag/rdbms/egmas/pams
INST_ID NAME
---------- ----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 Diag Trace
/dba/oracle/diag/rdbms/egmas/pams/trace
1 Diag Alert
/dba/oracle/diag/rdbms/egmas/pams/alert
1 Diag Incident
/dba/oracle/diag/rdbms/egmas/pams/incident
INST_ID NAME
---------- ----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 Diag Cdump
/dba/oracle/diag/rdbms/egmas/pams/cdump
1 Health Monitor
/dba/oracle/diag/rdbms/egmas/pams/hm
1 Default Trace File
/dba/oracle/diag/rdbms/egmas/pams/trace/pams_ora_29398.trc
INST_ID NAME
查看这个trace文件的中间内容:
more /dba/oracle/diag/rdbms/egmas/pams/trace/pams_ora_29398.trc
把创建控制文件的部分抠出来:
vi /tmp/controlpams.sql
CREATE CONTROLFILE REUSE DATABASE "EGMAS" NORESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 '+DATA_DG/egmas/onlinelog/group_4.594.832094113' SIZE 500M BLOCKSIZE 512,
GROUP 5 '+DATA_DG/egmas/onlinelog/group_5.595.832094149' SIZE 500M BLOCKSIZE 512,
GROUP 6 '+DATA_DG/egmas/onlinelog/group_6.596.832094161' SIZE 500M BLOCKSIZE 512,
GROUP 7 '+DATA_DG/egmas/onlinelog/group_7.597.832094171' SIZE 500M BLOCKSIZE 512,
GROUP 8 '+DATA_DG/egmas/onlinelog/group_8.598.832094179' SIZE 500M BLOCKSIZE 512,
GROUP 9 '+DATA_DG/egmas/onlinelog/group_9.599.832094189' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA_DG/egmas/datafile/system.584.832091273',
'+DATA_DG/egmas/datafile/sysaux.585.832091273',
'+DATA_DG/egmas/datafile/undotbs1.586.832091273',
'+DATA_DG/egmas/datafile/users.587.832091273',
'+DATA_DG/egmas/datafile/aud_data.591.832094553',
'+DATA_DG/egmas/datafile/aud_index.590.832094565',
'+DATA_DG/egmas/datafile/dbadata.589.832094675'
CHARACTER SET AL32UTF8
;
将其中的内容修改,指向你自己建的目录:
CREATE CONTROLFILE REUSE DATABASE "PAMS" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 '+DATA_DG/pams/onlinelog/group_4.594.832094113' SIZE 500M BLOCKSIZE 512,
GROUP 5 '+DATA_DG/pams/onlinelog/group_5.595.832094149' SIZE 500M BLOCKSIZE 512,
GROUP 6 '+DATA_DG/pams/onlinelog/group_6.596.832094161' SIZE 500M BLOCKSIZE 512,
GROUP 7 '+DATA_DG/pams/onlinelog/group_7.597.832094171' SIZE 500M BLOCKSIZE 512,
GROUP 8 '+DATA_DG/pams/onlinelog/group_8.598.832094179' SIZE 500M BLOCKSIZE 512,
GROUP 9 '+DATA_DG/pams/onlinelog/group_9.599.832094189' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA_DG/pams/datafile/system.584.832091273',
'+DATA_DG/pams/datafile/sysaux.585.832091273',
'+DATA_DG/pams/datafile/undotbs1.586.832091273',
'+DATA_DG/pams/datafile/users.587.832091273',
'+DATA_DG/pams/datafile/aud_data.591.832094553',
'+DATA_DG/pams/datafile/aud_index.590.832094565',
'+DATA_DG/pams/datafile/dbadata.589.832094675'
CHARACTER SET AL32UTF8
;
SQL>@/tmp/controlpams.sql --生成新的控制文件
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA_DG/egmas/controlfile/current.588.832091379
但是,当我们执行这个命令的时候,发现,控制文件虽然新建成功,但是,却在原来的路径。如下:
RMAN> restore controlfile from '+DATA_DG/egmas/controlfile/current.588.832091379';
Starting restore at 2013-11-29 20:38:40
using channel ORA_DISK_1
channel ORA_DISK_1: copied control file copy
output file name=+DATA_DG/egmas/controlfile/current.588.832091379 --新的控制文件
Finished restore at 2013-11-29 20:38:41
那么我就需要指定路径!!但是control_files这个参数只能在spfile中修改,那么我们就新建spfile,然后以spfile启动。
SQL> create spfile='/tmp/spfilepams.ora' from pfile='/tmp/pfileegmas.ora';
File created.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 7933816832 bytes
Fixed Size 2243872 bytes
Variable Size 1476395744 bytes
Database Buffers 6442450944 bytes
Redo Buffers 12726272 bytes
SQL> show parameter spfile
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
spfile string
/dba/oracle/product/11.2.0.3.0
/dbs/spfilepams.ora
SQL> alter system set control_files='+DATA_DG/pams/controlfile/current.588.832091379' scope=spfile sid='*';
System altered.
SQL> commit;
Commit complete.
RMAN> restore controlfile from '+DATA_DG/egmas/controlfile/current.588.832091379';
Starting restore at 2013-11-29 20:53:42
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA_DG/pams/controlfile/current.612.832798423
Finished restore at 2013-11-29 20:53:44
这样我们就终于搞定了三大文件。
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA_DG/pams/controlfile/current.612.832798423
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
+DATA_DG/pams/datafile/dbadata.608.832794821
+DATA_DG/pams/datafile/aud_index.607.832794761
+DATA_DG/pams/datafile/aud_data.615.832794687
+DATA_DG/pams/datafile/users.614.832794595
+DATA_DG/pams/datafile/undotbs1.611.832794927
+DATA_DG/pams/datafile/sysaux.609.832794857
+DATA_DG/pams/datafile/system.610.832794891
7 rows selected.
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA_DG/pams/onlinelog/group_12.613.832793723
+DATA_DG/pams/onlinelog/group_11.594.832793715
+DATA_DG/pams/onlinelog/group_10.606.832793705
4、将spfile移到DATA_DG中去
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /dba/oracle/product/11.2.0.3.0
/dbs/spfilepams.ora
SQL> create pfile='/tmp/pfilepams.ora' from spfile;
File created.
SQL> create spfile='+DATA_DG' from pfile='/tmp/pfilepams.ora';
File created.
SQL>
注意:要移走之前的spfile,并且修改initpams.ora的指向
cnsz03pl0032:pams > mv spfilepams.ora bak_spfilepams.ora
cnsz03pl0032:pams > cat initlscmst.ora
SPFILE='+DATA_DG/lscmst/spfilelscmst.ora'
cnsz03pl0032:pams > vi initpams.ora
SPFILE='+DATA_DG/PAMS/PARAMETERFILE/spfile.605.832798927'
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 7933816832 bytes
Fixed Size 2243872 bytes
Variable Size 1476395744 bytes
Database Buffers 6442450944 bytes
Redo Buffers 12726272 bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA_DG/pams/parameterfile/sp
file.605.832798927
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string pams
db_unique_name string pams
global_names boolean FALSE
instance_name string pams
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string pams
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA_DG/pams/onlinelog/group_12.613.832793723
+DATA_DG/pams/onlinelog/group_11.594.832793715
+DATA_DG/pams/onlinelog/group_10.606.832793705
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
+DATA_DG/pams/datafile/dbadata.608.832794821
+DATA_DG/pams/datafile/aud_index.607.832794761
+DATA_DG/pams/datafile/aud_data.615.832794687
+DATA_DG/pams/datafile/users.614.832794595
+DATA_DG/pams/datafile/undotbs1.611.832794927
+DATA_DG/pams/datafile/sysaux.609.832794857
+DATA_DG/pams/datafile/system.610.832794891
7 rows selected.
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATA_DG/egmas/controlfile/cur
rent.588.832091379
control_management_pack_access string DIAGNOSTIC+TUNING
到这里终于大功告成!!!!
备注:下面的例子是在ASM自动存储管理下实现的,同样也适用于文件系统。
1、创建pfile
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA_DG/egmas/spfileegmas.ora
SQL> create pfile='/tmp/pfileegmas.ora' from spfile;
File created.
shutdown immediate
[root@cnsz03pl0032 ~]# vi /etc/oratab
pams:/dba/oracle/product/11.2.0.3.0:N # line added by Agent
cnsz03pl0032:egmas > pwd
/dba/oracle/product/11.2.0.3.0/dbs
2、修改一些重要文件名
cnsz03pl0032:egmas > ls -l *egmas*
-rw-rw---- 1 oracle asmadmin 1544 Nov 29 14:31 hc_egmas.dat
-rw-r----- 1 oracle oinstall 40 Nov 21 16:31 initegmas.ora
-rw-r----- 1 oracle oinstall 1536 Nov 21 16:31 orapwegmas
-rw-r----- 1 oracle oinstall 9748480 Nov 21 20:04 snapcf_egmas.f
cnsz03pl0032:egmas > mv hc_egmas.dat hc_pams.dat
cnsz03pl0032:egmas > mv orapwegmas orapwpams
cnsz03pl0032:egmas > cp initegmas.ora initpams.ora
3、新建pams的adump目录
cnsz03pl0032:pams > cd $ORACLE_BASE/admin
cnsz03pl0032:pams > ll
total 84
drwxr-xr-x 3 oracle oinstall 4096 Sep 23 18:13 bamsst
drwxr-x--- 5 oracle oinstall 4096 Jul 13 02:30 bmpst
drwxr-x--- 5 oracle oinstall 4096 Jul 8 23:32 bspdbst
drwxr-x--- 5 oracle oinstall 4096 Jul 8 22:11 cmspst
drwxr-x--- 8 oracle oinstall 4096 Nov 1 16:40 ecsst
drwxr-x--- 5 oracle oinstall 4096 Nov 21 16:27 egmas
drwxr-x--- 5 oracle oinstall 4096 Jul 8 22:19 hncmspst
drwxr-xr-x 5 oracle oinstall 4096 Aug 9 09:37 hnsssst
drwxr-x--- 8 oracle oinstall 4096 Nov 21 14:26 iams
drwxr-x--- 5 oracle oinstall 4096 Jul 13 02:45 iiscst
drwxr-xr-x 8 oracle oinstall 4096 Oct 21 16:04 lscmst
drwxr-x--- 8 oracle oinstall 4096 Aug 30 17:50 omptest
drwxr-xr-x 8 oracle oinstall 4096 Oct 21 15:20 pamsst
drwxr-x--- 5 oracle oinstall 4096 Nov 13 14:36 rstdbst
drwxr-xr-x 3 oracle oinstall 4096 Jul 3 23:25 sfecpdb
drwxr-x--- 8 oracle oinstall 4096 Jul 9 07:32 sfgpsst
drwxr-x--- 5 oracle oinstall 4096 Oct 12 14:14 sfmpst
drwxr-xr-x 7 oracle oinstall 4096 Sep 24 14:22 sfossst
drwxr-x--- 5 oracle oinstall 4096 Jul 6 21:40 wbepinterfacest
drwxr-x--- 5 oracle oinstall 4096 Jul 4 23:53 wbepst
drwxr-x--- 5 oracle oinstall 4096 Jul 2 04:12 wqsdbst
cnsz03pl0032:pams > mkdir pams
cnsz03pl0032:pams > cd pams
cnsz03pl0032:pams > mkdir adump
4、修改参数文件
---重点修改db_unique_name为新的sid,但此时千万不要修改db_name,其他的也都该成新的sid即可。
cnsz03pl0032:pams > vi /tmp/pfileegmas.ora
pams.__db_cache_size=3439329280
pams.__java_pool_size=16777216
pams.__large_pool_size=16777216
pams.__oracle_base='/dba/oracle'#ORACLE_BASE set from environment
pams.__pga_aggregate_target=7063207936
pams.__sga_target=4294967296
pams.__shared_io_pool_size=0
pams.__shared_pool_size=788529152
pams.__streams_pool_size=0
*.archive_lag_target=900
*.audit_file_dest='/dba/oracle/admin/egmas/adump'
*.audit_sys_operations=TRUE
*.audit_trail='DB_EXTENDED'
*.compatible='11.2.0.0.0'
*.control_files='+DATA_DG/pams/controlfile/current.612.832798423'#Restore Controlfile
*.db_block_size=8192
*.db_cache_size=5368709120
*.db_create_file_dest='+DATA_DG'
*.db_domain=''
*.db_files=2000
*.db_keep_cache_size=1073741824
*.db_name='egmas' ---注意这里千万不要修改
*.db_unique_name='pams' --这里指定新的sid
*.db_recovery_file_dest='+FRA_DG'
*.db_recovery_file_dest_size=21474836480
*.db_unique_name='pams'
*.diagnostic_dest='/dba/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=pamsXDB)'
*.java_pool_size=83886080
*.large_pool_size=314572800
*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST'
*.log_archive_format='arch_%t_%s_%r.arc'
*.log_archive_max_processes=5
*.memory_target=0
*.open_cursors=300
*.pga_aggregate_target=2147483648
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.resource_limit=FALSE
*.resource_manager_plan=''
*.sessions=1105
*.sga_max_size=0
*.sga_target=0
*.shared_pool_size=1073741824
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
5、以新的db_unique_name 启动数据库到mount状态
SQL> startup mount pfile='/tmp/pfileegmas.ora';
ORACLE instance started.
Total System Global Area 7933816832 bytes
Fixed Size 2243872 bytes
Variable Size 1476395744 bytes
Database Buffers 6442450944 bytes
Redo Buffers 12726272 bytes
Database mounted.
6、此时我们新建日志组的话就会自动创建到+data_dg/pams下面
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA_DG/egmas/onlinelog/group_4.594.832094113
+DATA_DG/egmas/onlinelog/group_5.595.832094149
+DATA_DG/egmas/onlinelog/group_6.596.832094161
+DATA_DG/egmas/onlinelog/group_7.597.832094171
+DATA_DG/egmas/onlinelog/group_8.598.832094179
+DATA_DG/egmas/onlinelog/group_9.599.832094189
6 rows selected.
SQL> alter database add logfile group 10 '+DATA_DG' size 100m;
SQL> alter database add logfile group 11 '+DATA_DG' size 100m;
SQL> alter database add logfile group 12 '+DATA_DG' size 100m;
随便先建几组,后面改就可以了。
[grid@cnsz03pl0032 ~]$ asmcmd
ASMCMD> cd DATA_DG
ASMCMD> cd PAMS
ASMCMD> cd ONLINELOG
ASMCMD> ls
group_10.606.832793705
group_11.594.832793715
group_12.613.832793723
就可以看到了,使用命令SQL> select member from v$logfile; 也可以查到,之前的我们并不用删除。
7、复制数据文件。
RMAN> copy datafile '+DATA_DG/EGMAS/DATAFILE/AUD_DATA.591.832094553' to '+DATA_DG';
copy datafile '+DATA_DG/EGMAS/DATAFILE/
ASMCMD> ls
AUD_DATA.615.832794687
AUD_INDEX.607.832794761
DBADATA.608.832794821
SYSAUX.609.832794857
SYSTEM.610.832794891
UNDOTBS1.611.832794927
USERS.614.832794595
一样的操作,拷贝过来,虽然会报错,control有关,不用理会,数据文件可以拷贝过来了。
8、数据文件和日志文件都有了,下面是控制文件:
SQL> alter database backup controlfile to trace; 这里的会话千万不要退出
Database altered.
SQL> select * from v$diag_info;
INST_ID NAME
---------- ----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 Diag Enabled
TRUE
1 ADR Base
/dba/oracle
1 ADR Home
/dba/oracle/diag/rdbms/egmas/pams
INST_ID NAME
---------- ----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 Diag Trace
/dba/oracle/diag/rdbms/egmas/pams/trace
1 Diag Alert
/dba/oracle/diag/rdbms/egmas/pams/alert
1 Diag Incident
/dba/oracle/diag/rdbms/egmas/pams/incident
INST_ID NAME
---------- ----------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
1 Diag Cdump
/dba/oracle/diag/rdbms/egmas/pams/cdump
1 Health Monitor
/dba/oracle/diag/rdbms/egmas/pams/hm
1 Default Trace File
/dba/oracle/diag/rdbms/egmas/pams/trace/pams_ora_29398.trc
INST_ID NAME
查看这个trace文件的中间内容:
more /dba/oracle/diag/rdbms/egmas/pams/trace/pams_ora_29398.trc
把创建控制文件的部分抠出来:
vi /tmp/controlpams.sql
CREATE CONTROLFILE REUSE DATABASE "EGMAS" NORESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 '+DATA_DG/egmas/onlinelog/group_4.594.832094113' SIZE 500M BLOCKSIZE 512,
GROUP 5 '+DATA_DG/egmas/onlinelog/group_5.595.832094149' SIZE 500M BLOCKSIZE 512,
GROUP 6 '+DATA_DG/egmas/onlinelog/group_6.596.832094161' SIZE 500M BLOCKSIZE 512,
GROUP 7 '+DATA_DG/egmas/onlinelog/group_7.597.832094171' SIZE 500M BLOCKSIZE 512,
GROUP 8 '+DATA_DG/egmas/onlinelog/group_8.598.832094179' SIZE 500M BLOCKSIZE 512,
GROUP 9 '+DATA_DG/egmas/onlinelog/group_9.599.832094189' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA_DG/egmas/datafile/system.584.832091273',
'+DATA_DG/egmas/datafile/sysaux.585.832091273',
'+DATA_DG/egmas/datafile/undotbs1.586.832091273',
'+DATA_DG/egmas/datafile/users.587.832091273',
'+DATA_DG/egmas/datafile/aud_data.591.832094553',
'+DATA_DG/egmas/datafile/aud_index.590.832094565',
'+DATA_DG/egmas/datafile/dbadata.589.832094675'
CHARACTER SET AL32UTF8
;
将其中的内容修改,指向你自己建的目录:
CREATE CONTROLFILE REUSE DATABASE "PAMS" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 4 '+DATA_DG/pams/onlinelog/group_4.594.832094113' SIZE 500M BLOCKSIZE 512,
GROUP 5 '+DATA_DG/pams/onlinelog/group_5.595.832094149' SIZE 500M BLOCKSIZE 512,
GROUP 6 '+DATA_DG/pams/onlinelog/group_6.596.832094161' SIZE 500M BLOCKSIZE 512,
GROUP 7 '+DATA_DG/pams/onlinelog/group_7.597.832094171' SIZE 500M BLOCKSIZE 512,
GROUP 8 '+DATA_DG/pams/onlinelog/group_8.598.832094179' SIZE 500M BLOCKSIZE 512,
GROUP 9 '+DATA_DG/pams/onlinelog/group_9.599.832094189' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'+DATA_DG/pams/datafile/system.584.832091273',
'+DATA_DG/pams/datafile/sysaux.585.832091273',
'+DATA_DG/pams/datafile/undotbs1.586.832091273',
'+DATA_DG/pams/datafile/users.587.832091273',
'+DATA_DG/pams/datafile/aud_data.591.832094553',
'+DATA_DG/pams/datafile/aud_index.590.832094565',
'+DATA_DG/pams/datafile/dbadata.589.832094675'
CHARACTER SET AL32UTF8
;
SQL>@/tmp/controlpams.sql --生成新的控制文件
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA_DG/egmas/controlfile/current.588.832091379
但是,当我们执行这个命令的时候,发现,控制文件虽然新建成功,但是,却在原来的路径。如下:
RMAN> restore controlfile from '+DATA_DG/egmas/controlfile/current.588.832091379';
Starting restore at 2013-11-29 20:38:40
using channel ORA_DISK_1
channel ORA_DISK_1: copied control file copy
output file name=+DATA_DG/egmas/controlfile/current.588.832091379 --新的控制文件
Finished restore at 2013-11-29 20:38:41
那么我就需要指定路径!!但是control_files这个参数只能在spfile中修改,那么我们就新建spfile,然后以spfile启动。
SQL> create spfile='/tmp/spfilepams.ora' from pfile='/tmp/pfileegmas.ora';
File created.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 7933816832 bytes
Fixed Size 2243872 bytes
Variable Size 1476395744 bytes
Database Buffers 6442450944 bytes
Redo Buffers 12726272 bytes
SQL> show parameter spfile
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
spfile string
/dba/oracle/product/11.2.0.3.0
/dbs/spfilepams.ora
SQL> alter system set control_files='+DATA_DG/pams/controlfile/current.588.832091379' scope=spfile sid='*';
System altered.
SQL> commit;
Commit complete.
RMAN> restore controlfile from '+DATA_DG/egmas/controlfile/current.588.832091379';
Starting restore at 2013-11-29 20:53:42
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2 device type=DISK
channel ORA_DISK_1: copied control file copy
output file name=+DATA_DG/pams/controlfile/current.612.832798423
Finished restore at 2013-11-29 20:53:44
这样我们就终于搞定了三大文件。
SQL> alter database mount;
Database altered.
SQL> alter database open;
Database altered.
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
+DATA_DG/pams/controlfile/current.612.832798423
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
+DATA_DG/pams/datafile/dbadata.608.832794821
+DATA_DG/pams/datafile/aud_index.607.832794761
+DATA_DG/pams/datafile/aud_data.615.832794687
+DATA_DG/pams/datafile/users.614.832794595
+DATA_DG/pams/datafile/undotbs1.611.832794927
+DATA_DG/pams/datafile/sysaux.609.832794857
+DATA_DG/pams/datafile/system.610.832794891
7 rows selected.
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA_DG/pams/onlinelog/group_12.613.832793723
+DATA_DG/pams/onlinelog/group_11.594.832793715
+DATA_DG/pams/onlinelog/group_10.606.832793705
4、将spfile移到DATA_DG中去
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /dba/oracle/product/11.2.0.3.0
/dbs/spfilepams.ora
SQL> create pfile='/tmp/pfilepams.ora' from spfile;
File created.
SQL> create spfile='+DATA_DG' from pfile='/tmp/pfilepams.ora';
File created.
SQL>
注意:要移走之前的spfile,并且修改initpams.ora的指向
cnsz03pl0032:pams > mv spfilepams.ora bak_spfilepams.ora
cnsz03pl0032:pams > cat initlscmst.ora
SPFILE='+DATA_DG/lscmst/spfilelscmst.ora'
cnsz03pl0032:pams > vi initpams.ora
SPFILE='+DATA_DG/PAMS/PARAMETERFILE/spfile.605.832798927'
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 7933816832 bytes
Fixed Size 2243872 bytes
Variable Size 1476395744 bytes
Database Buffers 6442450944 bytes
Redo Buffers 12726272 bytes
Database mounted.
Database opened.
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA_DG/pams/parameterfile/sp
file.605.832798927
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string pams
db_unique_name string pams
global_names boolean FALSE
instance_name string pams
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string pams
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA_DG/pams/onlinelog/group_12.613.832793723
+DATA_DG/pams/onlinelog/group_11.594.832793715
+DATA_DG/pams/onlinelog/group_10.606.832793705
SQL> select file_name from dba_data_files;
FILE_NAME
--------------------------------------------------------------------------------
+DATA_DG/pams/datafile/dbadata.608.832794821
+DATA_DG/pams/datafile/aud_index.607.832794761
+DATA_DG/pams/datafile/aud_data.615.832794687
+DATA_DG/pams/datafile/users.614.832794595
+DATA_DG/pams/datafile/undotbs1.611.832794927
+DATA_DG/pams/datafile/sysaux.609.832794857
+DATA_DG/pams/datafile/system.610.832794891
7 rows selected.
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string +DATA_DG/egmas/controlfile/cur
rent.588.832091379
control_management_pack_access string DIAGNOSTIC+TUNING
到这里终于大功告成!!!!
发表评论
-
ETL工具--kettle简介
2016-02-24 11:21 0oracle ETL工具---数据迁移 常用的有:OWB(o ... -
oracle 游标实例
2015-12-31 17:23 1226oracle游标 游标-----内存 ... -
10053事件分析
2015-12-25 17:37 8161)10053介绍: 10053 事件是oracle 提供的用 ... -
oracle绑定变量学习
2015-12-25 17:01 1621绑定变量(binding variable) ... -
oracle 绑定变量
2015-12-24 17:26 0关键词: 绑定变量(binding variable),共享池 ... -
oracle插入大量数据
2015-12-23 17:35 1441oracle插入大量数据 1.生 ... -
ORA-03113:end-of-file on communication channel
2015-12-23 14:32 1179测试上面的一个库 plsql报错:shared memory ... -
oracle分区表【转】
2015-12-23 14:20 464oracle分区表 1.表空间及 ... -
迁移数据文件到ASM【转】
2015-12-23 11:53 8001.迁移数据文件到ASM 1) ... -
adrci命令
2015-12-23 11:46 3105一、adrci说明 在oracle11g中,dump ... -
用户+角色+权限
2015-12-21 17:58 925角色与用户权限的学习 ... -
oracle database link
2015-12-21 17:08 908目前我的数据库里只有tinadb一个实例,要创建db link ... -
oracle回收站
2015-12-21 14:22 461oracle回收站 1.drop table books; ... -
使用nid修改sid和dbname
2015-12-21 15:29 810如非必要,不建议在生产库上对dbid进行修改 1、修改dbi ... -
rman模拟故障恢复实验
2015-12-18 16:08 1188补充1:restore database和recover da ... -
rman命令学习-tina(下)
2015-12-18 16:07 1190五、rman删除 delete命令 删除相关的 ... -
rman命令学习-tina(上)
2015-12-18 16:06 920RMAN学习-tina rman的功能非常强大,下面我们来一 ... -
oracle profile介绍
2015-12-16 17:34 656profile文件的介绍: Oracle系统中的profi ... -
oracle缩小表空间
2015-12-18 16:59 1794oracle缩小表空间: oracle常用的此类命令Alte ... -
oracle数据库的启动和关闭【转】
2015-12-16 15:02 1175数据库的启动和关闭 Or ...
相关推荐
修改 Oracle_sid 和 db_name 名字 在 Oracle 数据库中,sid 和 db_name 是两个非常重要的参数,分别表示数据库实例名和数据库...修改 Oracle_sid 和 db_name 需要按照正确的步骤进行,以免对数据库造成不良的影响。
Oracle 中的全局数据库名称和 SID 的区别 Oracle 中的全局数据库名称和SID是两个不同的概念,分别用于标识数据库和实例。...了解这三个概念的区别和关系,对于Oracle数据库的管理和使用非常重要。
数据库最大连接数修改与 Oracle 多实例启动在 Linux 系统下 一、修改 Oracle 数据库允许的最大连接数 Oracle 数据库的最大连接数可以通过修改参数文件或使用 alter system 语句来实现。下面是修改最大连接数的步骤...
### AIX 下安装 Oracle 数据库与导入数据 #### 安装前检查 在开始 Oracle 数据库的安装之前,需要确保 AIX 操作系统的环境符合官方的要求。这些要求主要包括硬件资源如 CPU、内存以及交换空间的配置,同时也需要...
Oracle数据库在安装过程中,SID(System Identifier)是一个关键的配置参数,它用于唯一标识数据库实例。当卸载并重新安装Oracle数据库,如果尝试使用相同的SID,系统会报错,因为旧的SID信息仍然存在于系统中。这个...
Oracle数据库最大连接数修改和Linux系统下Oracle数据库多实例启动 一、修改Oracle数据库最大连接数 Oracle数据库的最大连接数是指数据库允许的最大并发连接数,该数值可以通过修改数据库参数来实现。下面是修改...
Oracle数据库是全球广泛使用的大型关系型数据库管理系统,其强大的功能和稳定性使其在企业级应用中占据了重要地位。本操作手册将深入探讨Oracle数据库的核心概念、安装配置、管理维护以及SQL查询等多个方面,帮助...
在进行Oracle数据库安装过程中,可能会遇到“SID已存在”的问题。SID(System Identifier)是Oracle实例的唯一标识符,如果系统中已经存在相同SID的实例,那么新的安装就会失败。本文将详细介绍如何解决Oracle安装时...
- 在ODBC数据源管理器中创建一个新的数据源,指定Oracle数据库的相关信息,如主机名、端口、服务名或SID(System Identifier,这里是"orcl")。 - 测试数据源连接以确保配置正确。 4. **使用ODBC或JDBC连接数据库...
为了与Oracle数据库交互,开发者通常需要提供数据库连接信息,包括数据库地址(SID或服务名)、用户名、密码和端口号等。 XML配置文件连接Oracle数据库的过程主要包括以下几个步骤: 1. **创建XML配置文件**:首先...
### Oracle 10G 数据库名、实例名、ORACLE_SID 及创建数据库详解 #### 一、数据库名 **1.1 定义** 数据库名是用于唯一标识一个数据库的...通过了解这些基本知识点,可以帮助初学者更好地理解和管理Oracle数据库系统。
易语言远程ORACLE数据库服务源码是针对编程者设计的一款基于易语言的代码资源,用于实现与ORACLE数据库的远程连接和交互。易语言是中国本土的一种面向对象的、易学易用的编程语言,它的设计理念是使编程变得更加简单...
在Oracle数据库系统中,数据库名(DB_NAME)、实例名(INSTANCE_NAME)以及操作系统环境变量(ORACLE_SID)是区分和管理数据库的关键概念。这些参数在不同的Oracle版本中有不同的作用和重要性。 首先,数据库名(DB...
本教程旨在为初学者提供一套完整的Oracle数据库安装与使用指南,帮助读者快速掌握Oracle的基础知识和操作技能。 首先,Oracle数据库的安装过程分为几个主要步骤。在Windows环境下,你需要下载适合你系统的Oracle ...
在UNIX环境下创建Oracle数据库是一项技术性很强的工作,它涉及到操作系统层面的配置以及Oracle数据库软件的安装和设置。这里我们将详细探讨这个过程中的关键步骤和重要知识点。 首先,我们需要确保环境变量正确配置...
Oracle 数据库版本为 Oracle 11gR1,SID 为 orcl,端口号为 1521。Oracle 相关账号包括 system 账号和 OSYUNWEI 账号等。 三、Linux 服务器下的 Oracle 数据库 在 Linux 服务器上,Oracle 数据库可以安装在 CentOS...
### Oracle数据库的安装和卸载知识点详述 #### 一、Oracle数据库概述 - **定义**: Oracle数据库是一种关系型数据库管理系统(RDBMS),由Oracle公司开发。它支持SQL语言,并且能够处理大量的并发用户和复杂的数据...
在Oracle数据库连接工具中,SQL Developer 是一个非常重要的免费工具,它是Oracle公司提供的一个集成开发环境(IDE),专门针对SQL语言进行设计,用于执行查询、管理对象、创建和修改数据库结构以及进行数据迁移任务...
【Oracle数据库实验报告】 在本实验报告中,我们将探讨Oracle数据库的配置、管理和维护过程,主要涉及以下几个关键知识点: 1. **监听程序配置**:Oracle数据库在运行前需要配置监听程序,通过...