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的更多相关文章

  1. Oracle创建表空间和表

    创建表空间和表ORACLE物理上是由磁盘上的以下几种文件:数据文件和控制文件和LOGFILE构成的oracle中的表就是一张存储数据的表.表空间是逻辑上的划分.方便管理的.数据表空间 (Tablesp ...

  2. 基础概念:Oracle数据库、实例、用户、表空间、表之间的关系

    基础概念:Oracle数据库.实例.用户.表空间.表之间的关系 数据库: Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实Oracle数据库 ...

  3. Oracle 数据库、实例、用户、表空间、表之间的关系

    数据库: Oracle数据库是数据的物理存储.这就包括(数据文件ORA或者DBF.控制文件.联机日志.参数文件).其实oracle数据库的概念和其它数据库不一样,这里的数据库是一个操作系统只有一个库. ...

  4. Oracle数据库不能创建表空间及表中文乱码问题

    1.不能创建表空间问题 datafile为表空间的存放位置,没有将表空间存放路径指定为orcl数据库时,创建表空间出错如下 查看自己的Oracle安装位置,我的Oracle10g安装在虚拟XP系统中, ...

  5. Oracle数据库、实例、用户、表空间、表之间的关系

    完整的Oracle数据库通常由两部分组成:Oracle数据库和数据库实例. 1) 数据库是一系列物理文件的集合(数据文件,控制文件,联机日志,参数文件等): 2) Oracle数据库实例则是一组Ora ...

  6. orale数据库.实例.表空间.用户.表

    近期因为工作原因接触到Oracle数据库.了解到Oracle和mysql的结构上还是有很大的区别的. Oracle数据库---实例---表空间---用户---表 我们将从这5个方面来了解Oracle ...

  7. 4.windows和Linux下创建oracleusername表空间,表,插入数据,用户管理表等操作

    进入超级管理员,运行下面命令 Window下创建数据库.表空间,用户,插入数据等操作 -- 01 创建表空间 -- 注意表空间的路径 依据实际安装环境进行调整 CREATE TABLESPACE ts ...

  8. 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: TEMP

    ylbtech-Oracle:数据库实例: STOREBOOK  >  表空间  >  编辑 表空间: TEMP 表空间  >  编辑 表空间: TEMP 1. 一般信息返回顶部 1 ...

  9. 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: USERS

    ylbtech-Oracle:数据库实例: STOREBOOK  >  表空间  >  编辑 表空间: USERS 表空间  >  编辑 表空间: USERS 1. 一般信息返回顶部 ...

  10. 数据库实例: STOREBOOK > 表空间 > 编辑 表空间: UNDOTBS1

    ylbtech-Oracle:数据库实例: STOREBOOK  >  表空间  >  编辑 表空间: UNDOTBS1 表空间  >  编辑 表空间: UNDOTBS1 1. 一般 ...

随机推荐

  1. &&和||的那点事儿

    以前一直以为&&和||的运算结果就是布尔值,但今天看到一段代码又填补的一些知识漏洞. var a = (1&&2&&5) || 3; console.l ...

  2. 8051学习笔记——IIC与EEPROM实验

    main.c #include <reg51.h> #include "iic.h" #define AT24C02 0xa0 //AT24C02 地址 sbit LS ...

  3. HTTP MIME类型即HttpResponse.ContentType属性值列表

    MIME-Typ Dateiendung(en) Bedeutung application/acad *.dwg AutoCAD-Dateien (nach NCSA) application/ap ...

  4. py2.7+pyqt4开发端口检测工具

    使用工具:python2.7,pyqt4,pyinstaller,pywin32 先贴代码 import sys from PyQt4 import QtGui,QtCore import threa ...

  5. vs2008 连接 VSS不提示输入密码

    之前使用的vs2005,每次登录的时候会有vss帐号输入框,如上图. 后来安装了vs2008,再打开源代码的时候输入框就不见了,下面是解决办法. --------------------------- ...

  6. 在网页中使用H1标记的须注意的事项

    H1标签是网站排名非常重要的一个因素,因此我们一定要正确使用它. 本文为你介绍H1标签使用的七大注意事项: 1.每个页面都应该有H1标签,H1标签是每个网页不可缺少的要素. 2.使用H1标签的内容应该 ...

  7. zencart用chrome无法登录后台

    再本地安装完zencart后,可以使用ie和Firefox登录网站后台,但是使用chrome登录时,页面闪一下,然后又跳转到登录页面. 按如下设置可以解决该问题: 中文版:商店设置->Sessi ...

  8. 修改Hosts后对火狐不起作用解决办法

    修改Hosts后对火狐不起作用: 重启火狐浏览器仍不起作用的话,执行下面操作即可. FireFox - 选项 - 高级 - 网络 - 立即清除(缓存)  就解决了

  9. Filestream读取或写入文件

    using System.IO;//引用 System.IO namespace filestream { public partial class Form1 : Form { public For ...

  10. Winform下WebBrowser 编辑模式 监听键盘按键事件

    最近使用 WebBrowser 做了个富文本编辑器(其实网上有很多很多).例如下面这个玩意(不要在意界面神马的) WebBrowser在编辑模式下可以有一些HTML标签的功能,改变字体大小颜色等等等. ...