收集Oracle常用命令—-表的相關操作

來源:互聯網
上載者:User

Oracle常用命令----表的相關操作

1.create a table
  功能描述:建立一個表格
sql> create table table_name (column datatype,column datatype]....)
sql> tablespace tablespace_name [pctfree integer] [pctused integer]
sql> [initrans integer] [maxtrans integer]
sql> storage(initial 200k next 200k pctincrease 0 maxextents 50)
sql> [logging|nologging] [cache|nocache]

2.copy an existing table
   功能描述:複製一個已存在的表格
sql> create table table_name [logging|nologging] as subquery

3.create temporary table 
   功能描述:建立一個暫存資料表格
sql> create global temporary table xay_temp as select * from xay;
on commit preserve rows/on commit delete rows

4.pctfree = (average row size - initial row size) *100 /average row size
pctused = 100-pctfree- (average row size*100/available data space)

5.change storage and block utilization parameter
sql> alter table table_name pctfree=30 pctused=50 storage(next 500k
sql> minextents 2 maxextents 100);

6.manually allocating extents
sql> alter table table_name allocate extent(size 500k datafile 'c:/oracle/data.dbf');

7.move tablespace
sql> alter table employee move tablespace users;

8.deallocate of unused space
sql> alter table table_name deallocate unused [keep integer]

9.truncate a table
sql> truncate table table_name;

10.drop a table 
   功能描述:刪除一個已存在的表格
sql> drop table table_name [cascade constraints];

11.drop a column 
   功能描述:刪除指定表格裡的指定列
sql> alter table table_name drop column comments cascade constraints checkpoint 1000;
alter table table_name drop columns continue;

12.mark a column as unused
sql> alter table table_name set unused column comments cascade constraints;
alter table table_name drop unused columns checkpoint 1000;
alter table orders drop columns continue checkpoint 1000
data_dictionary : dba_unused_col_tabs

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.