环境:
Oracle10.2 RAC 到10.2单机环境运行;
[@more@]1.准备好相应的目录结构
$cd /home/oracle/admin
$mkdir test
$cd test
$mkdir adump bdump cdump dpdump pfile udump
2.使用initoraT.ora创建参数文件inittest.ora
$cd dbs
$cp initoraT.ora inittest.ora
修改inittest2.ora
test.__db_cache_size=8388608
test.__java_pool_size=4194304
test.__large_pool_size=4194304
test.__shared_pool_size=67108864
test.__streams_pool_size=4194304
*.audit_file_dest='/home/oracle/admin/test/adump'
*.background_dump_dest='/home/oracle/admin/test/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/home/oracle/oradata/test/control01.dbf','/home/oracle/oradata/test/control02.dbf'
*.core_dump_dest='/home/oracle/admin/test/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='test'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/oracle/admin/test/udump'
*.DB_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
*.LOG_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
3.创建密码文件
$orapwd file=orapwtest password=oracle entries=10
4.配置好监听和tnsnames
5.使用rman备份原库
先做一次包括archivelog的全备份
run {
allocate channel t1 type disk;
backup current controlfile;
backup full database;
backup archivelog all;
release channel t1;
}
6. 启动test到nomount状态;
SQL>startup nomount
7.开始duplicate target database to "test"
先set ORACLE_SID=test /*cloneSID*/
获得原数据文件的number方法:
SQL>select 'set new name for datafile '||FILE#||' to '||'"'||trim(name)||'"' FROM v$datafile;
rman>connect target sys/oracle@oraT
rman>connect auxiliary sys/oracle
run{
allocate auxiliary channel t1 type disk;
set newname for datafile 1 to '/home/oracle/oradata/test/system01.dbf';
set newname for datafile 2 to '/home/oracle/oradata/test/undotbs1.bdf';
set newname for datafile 3 to '/home/oracle/oradata/test/sysaux01.dbf';
set newname for datafile 4 to '/home/oracle/oradata/test/users01.bdf';
set newname for datafile 5 to '/home/oracle/oradata/test/t1.dbf';
DUPLICATE TARGET DATABASE TO "test"
LOGFILE
GROUP 1 ('/home/oracle/oradata/test/redo01.log') SIZE 5M,
GROUP 2 ('/home/oracle/oradata/test/redo02.log') SIZE 5M,
GROUP 3 ('/home/oracle/oradata/test/redo03.log') SIZE 5M;
}
8.测试,并创建spfile;
删除pfile文件中的参数:
*.DB_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
*.LOG_FILE_NAME_CONVERT=('/home/oracle/oradata/oraT','/home/oracle/oradata/test')
SQL> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 62916852 bytes
Database Buffers 100663296 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /home/oracle/product/10.2/db/d
bs/spfiletest.ora
SQL> show parameter instance;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
active_instance_count integer
cluster_database_instances integer 1
instance_groups string
instance_name string test
instance_number integer 0
instance_type string RDBMS
open_links_per_instance integer 4
parallel_instance_group string
parallel_server_instances integer 1
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string test
SQL> show parameter db_do
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string
SQL> show parameter service_names
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string test
[oracle@OTest dbs]$ sqlplus system/oracle@test
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 25 01:05:49 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
test OPEN
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/74346/viewspace-916127/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/74346/viewspace-916127/