| 订阅 | 在线投稿
分享
 
 
 

在Oracle数据库中移动数据文件的具体方法

2008-08-05 07:04:54  编辑来源:互联网  宽屏版  评论

本文为【在Oracle数据库中移动数据文件的具体方法】的汉字拼音对照版显示拼音

yi.yidongshujuwenjian

keyiyongALTER DATABASEALTER TABLESPACEliangzhongfangfayidongshujuwenjian

1. ALTER DATABASEfangfa

yongcifangfakeyiyidongrenhebiaokongjiandeshujuwenjian

STEP 1. xiashujuku

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> SHUTDOWN;

SQL> EXIT;

STEP 2.yongcaozuoxitongminglingyidongshujuwenjian

jiangshujuwenjian test.ora cong/ora/oracle/data1muluyidongdao/ora/oracle/data2muluxia

$ mv /ora/oracle/data1/test.ora /ora/oracle/data2

STEP 3. MountshujukuyongALTER DATABASEminglingjiangshujuwenjiangaiming

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> STARTUP MOUNT;

SQL> ALTER DATABASE RENAME FILE /ora/oracle/data1/test.ora TO /ora/oracle/data2/test.ora;

STEP 4. dakaishujuku.

SQL> ALTER DATABASE OPEN;

SQL>SELECT NAME,STATUS FROM V$DATAFILE

2. ALTER TABLESPACEfangfa

yongcifangfayaoqiucishujuwenjianjibushuyuSYSTEMbiaokongjianyebushuyuhanyouACTIVEhuigunduanhuolinshiduandebiaokongjian

STEP1. jiangcishujuwenjiansuozaidebiaokongjianOFFLINE

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> ALTER TABLESPACE test OFFLINE;

SQL> EXIT;

STEP2. yongcaozuoxitongminglingyidongshujuwenjian

jiangshujuwenjian test.ora cong/ora/oracle/

data1muluyidongdao/ora/oracle/data2muluxia

$ mv /ora/oracle/data1/test.ora /ora/oracle/data2

STEP3. yongALTER TABLESPACEminglinggaishujuwenjianming

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> ALTER TABLESPACE test RENAME DATAFILE /ora/oracle/data1/test.ora TO /ora/oracle/data2/test.ora;

STEP4. jiangcishujuwenjiansuozaidebiaokongjianONLINE

SQL> ALTER TABLESPACE test ONLINE;

SQL> SELECT NAME,STATUS FROM V$DATAFILE

er. yidongkongzhiwenjian

kongzhiwenjian zai INIT.ORAwenjianzhongzhidingyidongkongzhiwenjianxiangduibijiaojiandanxiashujuku

bianjiINIT.ORAyidongkongzhiwenjianchongqidongshujuku

STEP 1. xiashujuku

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> SHUTDOWN;

SQL> EXIT;

STEP 2.yongcaozuoxitongmingling yidongkongzhiwenjian

jiangkongzhiwenjianctl3orcl.ora cong/ora/oracle/data1muluyidongdao/ora/oracle/data2muluxia

$ mv /ora/oracle/data1/ctrlorcl3.ora /ora/oracle/data2

STEP 3. bianjiINIT.ORAwenjian

INIT.ORAwenjiandezai$ORACLE_HOME/dbsmuluxia

xiugaishenshu control_filesqizhongzhidingyidonghoudekongzhiwenjian

control_files = (/ora/oracle/data1/ctrlorcl1.ora,/ora/oracle/data1/ctrlorcl2.ora,/ora/oracle/data2/ctrlorcl3.ora)

STEP 4. chongqidongshujuku

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> STARTUP;

SQL>SELECT name FROM V$CONTROLFILE;

SQL> EXIT;

san. yidonglianjirizhiwenjian

STEP 1. tingshujuku

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> SHUTDOWN;

SQL> EXIT;

STEP 2. yongcaozuoxitongminglingyidonglianjirizhiwenjian

jianglianjirizhiwenjianredolog1.ora cong/ora/oracle/data1muluyidongdao/ora/oracle/data2muluxia

$ mv /ora/oracle/data1/redolog1.ora /ora/oracle/data2

STEP 3. MountshujukuyongALTER DATABASE minglinggailianjirizhiwenjianming.

$ sqlplus /nolog

SQL> CONNECT INTERNAL;

SQL> STARTUP MOUNT ;

SQL> ALTER DATABASE RENAME FILE /ora/oracle/data1/redolog1.ora TO /ora/oracle/data2/redolog1.ora;

STEP 4.chongqidongshujuku .

SQL> ALTER DATABASE OPEN;

SQL>SELECT MEMBER FROM V$LOGFILE

原文
一.移动数据文件: – 可以用ALTER DATABASE,ALTER TABLESPACE两种方法移动数据文件。 1. ALTER DATABASE方法; – 用此方法,可以移动任何表空间的数据文件。 ◆STEP 1. 下数据库: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> SHUTDOWN; SQL> EXIT; ◆STEP 2.用操作系统命令移动数据文件: – 将数据文件 ‘test.ora’ 从/ora/oracle/data1目录移动到/ora/oracle/data2目录下: $ mv /ora/oracle/data1/test.ora /ora/oracle/data2 ◆STEP 3. Mount数据库,用ALTER DATABASE命令将数据文件改名: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> STARTUP MOUNT; SQL> ALTER DATABASE RENAME FILE ‘/ora/oracle/data1/test.ora’ TO ‘/ora/oracle/data2/test.ora’; ◆STEP 4. 打开数据库:. SQL> ALTER DATABASE OPEN; SQL>SELECT NAME,STATUS FROM V$DATAFILE; 2. ALTER TABLESPACE方法: – 用此方法,要求此数据文件既不属于SYSTEM表空间,也不属于含有ACTIVE回滚段或临时段的表空间。 ◆STEP1. 将此数据文件所在的表空间OFFLINE: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> ALTER TABLESPACE test OFFLINE; SQL> EXIT; ◆STEP2. 用操作系统命令移动数据文件: 将数据文件 ‘test.ora’ 从/ora/oracle/ data1目录移动到/ora/oracle/data2目录下: $ mv /ora/oracle/data1/test.ora /ora/oracle/data2 ◆STEP3. 用ALTER TABLESPACE命令改数据文件名: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> ALTER TABLESPACE test RENAME DATAFILE ‘/ora/oracle/data1/test.ora’ TO ‘/ora/oracle/data2/test.ora’; ◆STEP4. 将此数据文件所在的表空间ONLINE: SQL> ALTER TABLESPACE test ONLINE; SQL> SELECT NAME,STATUS FROM V$DATAFILE; 二. 移动控制文件: – 控制文件 在 INIT.ORA文件中指定。移动控制文件相对比较简单,下数据库, – 编辑INIT.ORA,移动控制文件,重启动数据库。 ◆STEP 1. 下数据库: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> SHUTDOWN; SQL> EXIT; ◆STEP 2.用操作系统命令 移动控制文件: –将控制文件’ctl3orcl.ora’ 从/ora/oracle/data1目录移动到/ora/oracle/data2目录下: $ mv /ora/oracle/data1/ctrlorcl3.ora /ora/oracle/data2 ◆STEP 3. 编辑INIT.ORA文件: INIT.ORA文件的在$ORACLE_HOME/dbs目录下, 修改参数 “control_files”,其中指定移动后的控制文件: control_files = (/ora/oracle/data1/ctrlorcl1.ora,/ora/oracle/data1/ctrlorcl2.ora,/ora/oracle/data2/ctrlorcl3.ora) ◆STEP 4. 重启动数据库: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> STARTUP; SQL>SELECT name FROM V$CONTROLFILE; SQL> EXIT; 三. 移动联机日志文件: ◆STEP 1. 停数据库: $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> SHUTDOWN; SQL> EXIT; ◆STEP 2. 用操作系统命令移动联机日志文件: –将联机日志文件’redolog1.ora’ 从/ora/oracle/data1目录移动到/ora/oracle/data2目录下: $ mv /ora/oracle/data1/redolog1.ora /ora/oracle/data2 ◆STEP 3. Mount数据库,用ALTER DATABASE 命令改联机日志文件名:. $ sqlplus /nolog SQL> CONNECT INTERNAL; SQL> STARTUP MOUNT ; SQL> ALTER DATABASE RENAME FILE ‘/ora/oracle/data1/redolog1.ora’ TO ‘/ora/oracle/data2/redolog1.ora’; ◆STEP 4.重启动数据库: . SQL> ALTER DATABASE OPEN; SQL>SELECT MEMBER FROM V$LOGFILE;
󰈣󰈤
 
 
 
>>返回首页<<
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
王朝网络微信公众号
微信扫码关注本站公众号wangchaonetcn
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有