Oracle复制表分为只复制表结构或者结构和数据均复制两种:

  • 只复制表结构 

       create table newTableName as select * from oldTableName where 1=2;

  • 复制表的结构和数据 

      create table newTableName as select * from oldTableName ;

  • 只复制表的数据

        结构一样: insert into newTableName select * from oldTable;

       结构不一样: insert into newTableName(column1,column2...) select column1,column2... from oldTableName;

   注意:当在不同角色之间进行表的复制时,应注意权限。例如角色A想复制角色B中的EMP表时,需要给A赋权限A         

      grant select  on EMP to B; //查询

      grant all on emp to B ; //拥有所有权限

     例如: create table emp as select * from B.emp;

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
  • 2021-06-27
  • 2021-08-31
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
猜你喜欢
  • 2021-12-21
  • 2022-02-09
  • 2021-08-12
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
相关资源
相似解决方案