[转帖]noarchive model,迁tablespace从ASM到Local files fs_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 2210 | 回复: 0   主题: [转帖]noarchive model,迁tablespace从ASM到Local files fs        下一篇 
yanghui
注册用户
等级:上尉
经验:584
发帖:92
精华:0
注册:2011-12-13
状态:离线
发送短消息息给yanghui 加好友    发送短消息息给yanghui 发消息
发表于: IP:您无权察看 2015-3-16 10:12:14 | [全部帖] [楼主帖] 楼主

noarchive model,迁tablespace从ASM到Local files fs

利用rman 可以方便的把datafile,tablespace,database在本地文件系统和ASM之间转换

小例子
single instance 转换一个TABLESPACE 从 ASM 到 本地文件

[oracle@rac1 dbfiles]$ ora

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 9 20:50:17 2012

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options

SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 244
Current log sequence 246

SQL> select file_id,file_name,tablespace_name,bytes/1024/1024 total_mb from dba_data_files;

FILE_ID FILE_NAME TABLESPACE_NAME TOTAL_MB
---------- -------------------------------------------------- ------------------------------ ----------
4 +DATA/anbob/datafile/users.259.781398343 USERS 15
3 +DATA/anbob/datafile/undotbs1.258.781398343 UNDOTBS1 160
2 +DATA/anbob/datafile/sysaux.257.781398339 SYSAUX 750
1 +DATA/anbob/datafile/system.256.781398335 SYSTEM 700
5 +DATA/anbob/datafile/mydata.270.781669087 MYDATA 100

[oracle@rac1 dbfiles]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jul 9 20:54:17 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connected to target database: ANBOB (DBID=1158650278)

RMAN> backup as copy tablespace mydata format '/u01/app/oracle/dbfiles/mydata01.dbf';

Starting backup at 09-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 07/09/2012 20:55:06
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode

RMAN> sql "alter tablespace mydata offline";

sql statement: alter tablespace mydata offline

RMAN> backup as copy tablespace mydata format '/u01/app/oracle/dbfiles/mydata01.dbf';

Starting backup at 09-JUL-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/anbob/datafile/mydata.270.781669087
output file name=/u01/app/oracle/dbfiles/mydata01.dbf tag=TAG20120709T205558 RECID=1 STAMP=788216170
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
Finished backup at 09-JUL-12

RMAN> switch tablespace mydata to copy;

datafile 5 switched to datafile copy "/u01/app/oracle/dbfiles/mydata01.dbf"

RMAN> recover tablespace mydata;

Starting recover at 09-JUL-12
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 09-JUL-12

RMAN> sql "alter tablespace mydata online";

sql statement: alter tablespace mydata online

RMAN> exit

SQL> col file_name for a50
SQL> set linesize 150
SQL> select file_id,file_name,tablespace_name,bytes/1024/1024 total_mb from dba_data_files;

FILE_ID FILE_NAME TABLESPACE_NAME TOTAL_MB
---------- -------------------------------------------------- ------------------------------ ----------
4 +DATA/anbob/datafile/users.259.781398343 USERS 15
3 +DATA/anbob/datafile/undotbs1.258.781398343 UNDOTBS1 160
2 +DATA/anbob/datafile/sysaux.257.781398339 SYSAUX 750
1 +DATA/anbob/datafile/system.256.781398335 SYSTEM 700
5 /u01/app/oracle/dbfiles/mydata01.dbf MYDATA 100

[oracle@rac1 dbfiles]$ asmcmd
Connected to an idle instance.
ASMCMD> ls
ASMCMD-08102: no connection to ASM; command requires ASM to run
[oracle@rac1 ~]$ su - grid
Password:
[grid@rac1 ~]$ asmcmd
ASMCMD> ls
DATA/
ASMCMD> cd DATA/anbob/datafile
ASMCMD> ls
MYDATA.270.781669087
SYSAUX.257.781398339
SYSTEM.256.781398335
UNDOTBS1.258.781398343
USERS.259.781398343
ASMCMD> rm MYDATA.270.781669087
ASMCMD> exit

test!
sys@ANBOB>create table t (id int) tablespace mydata;

Table created.

--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论