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. 在git 服务器挂载新的项目

      1.cmd 到新创建的文件夹位置,然后 执行该命令git init --bare 2.在客户端克隆项目到文件夹(空),将项目复制到该空文件夹下,然后打开git extent,提交并推送

  2. NOIP2004 虫食算

    描述 所谓虫食算,就是原先的算式中有一部分被虫子啃掉了,需要我们根据剩下的数字来判定被啃掉的字母.来看一个简单的例子:43#9865#045+ 8468#6633= 44445506678其中#号代表 ...

  3. MySQL版本调研

    1引言 1.1 编写目的 本文的主要目的是通过对当前项目中使用的各种版本的数据库进行比较,分析各自特性和稳定程度,最终推荐合适的版本作为今后的标准数据库. 1.2 背景 当前,部门负责管理维护的现网使 ...

  4. 关键字 this 的作用

    1.关键字 this ①是指当前对象自己 当一个类中要明确指出使用对象自己的变量或函数时,就应该加上this关键字,小栗子a如下: public class A { string Name = &qu ...

  5. [Nginx 2] form表单提交,图片上传

    导读:昨晚恶补了一些Nginx服务器的东西,从整体上对Nginx有一个初步的了解.上午去找师哥问了问目前项目中的使用情况,然后就开始上传图片了.这里就简单总结整理一下今天的成果,以后接着提升.简单粗暴 ...

  6. ionic ngcordova barcodescanner

    二維碼掃描  最近有一個項目用到了 二維碼的掃描  總結一下 記錄一下 1.  ionic platform add ios 2. 添加插件 cordova plugin add https://gi ...

  7. openstack实例热迁移

    [DEFAULT]scheduler_default_filters=AllHostsFilterallow_resize_to_same_host=Trueallow_migrate_to_same ...

  8. WWF3XOML方式创建和启动工作流 <第十篇>

    一.XOML使用工作流的好处 通过Xoml方式使用工作流的好处在于,它能够不重新启动程序的情况下,仅仅通过配置xoml就能够实现改变工作流,非常灵活. 创建一个WinForm程序如下: 代码如下: n ...

  9. 手机NFC模拟门禁卡

    楼主所在的某电子科技类大学,从宿舍楼到实验楼到图书馆办公楼,全部都有门禁,前两天突然在某安软件市场看到一个可以模拟门禁卡的软件,然而可能是我的手机系统太6了,竟然模拟不了,无奈自己动手,从根本上解决问 ...

  10. 【Qt】使用QProcess调用其它程序或脚本

    大概试了一下,还是不错的,不过字符编码问题还不太好解决: 代码: #include "mainwindow.h" #include "ui_mainwindow.h&qu ...