在oracle数据库中,所有表信息存放在表all_tables中,所有用户表存放在表user_tables中;
1,创建表:
SQL> create table table_bob1 (id int, name varchar2(30),title varchar2(40)) tablespace bobtablespace;
2,拷贝表:
SQL> create table table_bob2 as (select * from table_bob1);
3,创建临时表:
create global temporary table bob_temp as (select * from table_bob2);
4,改动表扩展属性
SQL> alter table table_bob1 allocate extent (size 500k datafile '/oracle/bob/bob3.dbf');
5,在不同表空间移动表:
SQL> alter table table_bob1 move tablespace system;
SQL> alter table table_bob1 move tablespace bobtablespace;
6,清空表的内容:
SQL> truncate table table_bob2;
7,将一个表达内容拷贝到另一个表:
SQL> insert into table_bob2 select * from table_bob1;
8,释放不用的空间:
SQL> alter table table_bob1 deallocate unused;
9,删除表:
SQL> drop table table_bob1;
10,删除列:
SQL> alter table scott.table_bob3 drop column id;
11,添加列:
SQL> alter table scott.table_bob3 add (id number default 1);
阅读(2544) | 评论(0) | 转发(0) |