oracle 表空间和表 read only迁移后不再read only
DB : 11.2.0.3.0
1.将tablespace read only , 不允许再对表进行update、insert操作,测试dmp到另一个用户、表空间后是否可以update、insert
2.将table read only, 不允许再对表进行update、insert操作, 测试dmp表到另一个用户、表空间后是否可以update、insert
1.
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/yoon01.dbf
SQL> create tablespace yoon datafile '/u01/app/oracle/oradata/orcl/yoon01.dbf' size 100m;
Tablespace created.
SQL> create user yoon identified by yoon default tablespace yoon ;
User created.
SQL> grant dba to yoon;
Grant succeeded.
SQL>show user
USER is "YOON"
SQL> create table yoon as select * from scott.emp;
Table created.
SQL> alter tablespace yoon read only;
Tablespace altered.
更新:
SQL> update yoon set empno=9999 where empno=7934;
update yoon set empno=9999 where empno=7934
*
ERROR at line 1:
ORA-00372: file 5 cannot be modified at this time
ORA-01110: data file 5: '/u01/app/oracle/oradata/orcl/yoon01.dbf'
插入:
SQL> insert into yoon select * from scott.emp;
insert into yoon select * from scott.emp
*
ERROR at line 1:
ORA-00372: file 5 cannot be modified at this time
ORA-01110: data file 5: '/u01/app/oracle/oradata/orcl/yoon01.dbf'
备份:
[oracle@db01 backup]$ expdp system/admin directory=data dumpfile=yoon.dmp logfile=yoon.log tables=yoon.yoon
Export: Release 11.2.0.3.0 - Production on Fri Oct 31 21:53:46 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_EXPORT_TABLE_01": system/******** directory=data dumpfile=yoon.dmp logfile=yoon.log tables=yoon.yoon
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "YOON"."YOON" 8.570 KB 14 rows
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:
/u01/backup/yoon.dmp
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 21:54:02
[oracle@db01 backup]$ ls
yoon.dmp yoon.log
导入至scott用户:
[oracle@db01 backup]$ impdp system/admin directory=data dumpfile=yoon.dmp logfile=yoon_imp.log tables=yoon.yoon remap_schema=yoon:scott remap_tablespace=yoon:users
Import: Release 11.2.0.3.0 - Production on Fri Oct 31 21:55:43 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01": system/******** directory=data dumpfile=yoon.dmp logfile=yoon_imp.log tables=yoon.yoon remap_schema=yoon:scott remap_tablespace=yoon:users
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."YOON" 8.570 KB 14 rows
Job "SYSTEM"."SYS_IMPORT_TABLE_01" successfully completed at 21:55:50
查看scott用户下表的状态:
SQL> select owner,table_name,TABLESPACE_NAME,STATUS,TABLE_LOCK,READ_ONLY from dba_tables where table_name='YOON' and owner='SCOTT';
OWNER TABLE_NAME TABLESPACE_NAME STATUS TABLE_LO REA
---------- --------------- ------------------------------ -------- -------- ---
SCOTT YOON USERS VALID ENABLED NO
SQL> update yoon set empno=9999 where empno=7934;
1 row updated.
SQL> insert into yoon select * from emp;
14 rows created.
SQL> commit;
将表空间read only后,将表迁移至另一个用户、表空间,可以进行update、insert操作。
2.
SQL> alter tablespace yoon read write;
Tablespace altered.
SQL> alter table yoon read only;
Table altered.
备份yoon表:
[oracle@db01 backup]$ expdp system/admin directory=data dumpfile=yoon.dmp logfile=yoon.log tables=yoon.yoon
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:
/u01/backup/yoon.dmp
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 22:03:29
导入yoon表至scott用户:
[oracle@db01 backup]$ impdp system/admin directory=data dumpfile=yoon.dmp logfile=yoon_imp.log tables=yoon.yoon remap_schema=yoon:scott remap_tablespace=yoon:users
Import: Release 11.2.0.3.0 - Production on Fri Oct 31 22:04:44 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TABLE_01": system/******** directory=data dumpfile=yoon.dmp logfile=yoon_imp.log tables=yoon.yoon remap_schema=yoon:scott remap_tablespace=yoon:users
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."YOON" 8.570 KB 14 rows
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_TABLE_01" successfully completed at 22:04:49
查看表的状态:
SQL> select owner,table_name,TABLESPACE_NAME,STATUS,TABLE_LOCK,READ_ONLY from dba_tables where table_name='YOON' and owner='SCOTT';
OWNER TABLE_NAME TABLESPACE STATUS TABLE_LO REA
---------- --------------- ---------- -------- -------- ---
SCOTT YOON USERS VALID ENABLED NO
SQL> update yoon set empno=9999 where empno=7934;
1 row updated.
SQL> insert into yoon select * from emp;
14 rows created.
SQL> commit;
将表设置read only,迁移至另一个用户、表空间后,可以进行update、insert操作 。
oracle 表空间和表 read only迁移后不再read only的更多相关文章
- Oracle创建表空间和表
创建表空间和表ORACLE物理上是由磁盘上的以下几种文件:数据文件和控制文件和LOGFILE构成的oracle中的表就是一张存储数据的表.表空间是逻辑上的划分.方便管理的.数据表空间 (Tablesp ...
- 基础概念:Oracle数据库、实例、用户、表空间、表之间的关系
基础概念:Oracle数据库.实例.用户.表空间.表之间的关系 数据库: Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实Oracle数据库 ...
- Oracle 数据库、实例、用户、表空间、表之间的关系
数据库: Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实oracle数据库的概念和其它数据库不一样,这里的数据库是一个操作系统只有一个库. ...
- Oracle数据库不能创建表空间及表中文乱码问题
1.不能创建表空间问题 datafile为表空间的存放位置,没有将表空间存放路径指定为orcl数据库时,创建表空间出错如下 查看自己的Oracle安装位置,我的Oracle10g安装在虚拟XP系统中, ...
- Oracle数据库、实例、用户、表空间、表之间的关系
完整的Oracle数据库通常由两部分组成:Oracle数据库和数据库实例. 1) 数据库是一系列物理文件的集合(数据文件,控制文件,联机日志,参数文件等): 2) Oracle数据库实例则是一组Ora ...
- orale数据库.实例.表空间.用户.表
近期因为工作原因接触到Oracle数据库.了解到Oracle和mysql的结构上还是有很大的区别的. Oracle数据库---实例---表空间---用户---表 我们将从这5个方面来了解Oracle ...
- 4.windows和Linux下创建oracleusername表空间,表,插入数据,用户管理表等操作
进入超级管理员,运行下面命令 Window下创建数据库.表空间,用户,插入数据等操作 -- 01 创建表空间 -- 注意表空间的路径 依据实际安装环境进行调整 CREATE TABLESPACE ts ...
- 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: TEMP
ylbtech-Oracle:数据库实例: STOREBOOK > 表空间 > 编辑 表空间: TEMP 表空间 > 编辑 表空间: TEMP 1. 一般信息返回顶部 1 ...
- 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: USERS
ylbtech-Oracle:数据库实例: STOREBOOK > 表空间 > 编辑 表空间: USERS 表空间 > 编辑 表空间: USERS 1. 一般信息返回顶部 ...
- 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: UNDOTBS1
ylbtech-Oracle:数据库实例: STOREBOOK > 表空间 > 编辑 表空间: UNDOTBS1 表空间 > 编辑 表空间: UNDOTBS1 1. 一般 ...
随机推荐
- Oracle 自定义函数Function
示例代码: CREATE OR REPLACE FUNCTION "MY_DATABASE"."F_GET_USER_COUNT_BY_DEPART" ( D ...
- Leaf-spine data center architectures
http://longwhiteclouds.com/2015/03/26/configuring-scalable-low-latency-l2-leaf-spine-network-fabrics ...
- C# 中DataGridView 绑定List<T>做数据源的操作问题
若想将 List<T>作为DataGridView的数据源,然后后续还想继续操作的话,需要将List<T>赋值给BindingList对象, 然后直接将BindingList赋 ...
- IE 下的z-index BUG问题
今天做项目的时候在IE7 碰到了IE 的 z-index 问题: 然后问了几个朋友,总结了一下z-index问题的几个要点: 1.z-index 是要在position为relative或者absol ...
- iOS常用插件
iOS常用插件总结:http://blog.csdn.net/oik_ios/article/details/50251191http://www.jianshu.com/p/d24eea8b405a ...
- Windows phone 8 学习笔记(6) 多任务(转)
Windows phone 8 是一个单任务操作系统,任何时候都只有一个应用处于活跃状态,这里的多任务是指对后台任务的支持.本节我们先讲讲应用程序的运行状态,然后看看支持的后台任务,包括:后台代理.后 ...
- A planning attack on a commuter train carriage in Taipei
Last night an explosion on a commuter train carriage in Taipei Songshan railway station wounded at l ...
- Android IOS WebRTC 音视频开发总结(三四)-- windows.20150706
最近好不容易更新了PC版的WEBRTC,总结下有哪些调整,文章来自博客园RTC.Blacker,支持原创,转载请说明出处. 图1:解决方案工程结构对比: 说明: 1, 最大的调整就是移除了VideoE ...
- 一款简单射击游戏IOS源码
源码描述: 一款基于cocos2d的简单设计游戏,并且也是一款基于cocos2d的简单射击游戏(含苹果IAD广告), 游戏操作很简单,哪个数字大就点击射击哪个.里面有苹果iad广告,功能简单完整,适合 ...
- Idea基本设置
1.idea 如何更改比编辑器文本字体和大小 换上了intellij idea之后,第一件事就是想要改变下文字字体,因为在我这个27寸的2k分辨率的屏幕上,文字显然太小了. intellij idea ...