1.配置測(cè)試環(huán)境
創(chuàng)建數(shù)據(jù)表空間
create tablespace test logging datafile '/home/oracle/test.dbf' size 10m autoextend on next 10m maxsize 2048m extent management local;
創(chuàng)建用戶(hù)并指定表空間
create user test identified by 123456 default tablespace test;
給用戶(hù)授予權(quán)限
grant connect,resource,dba to test;
創(chuàng)建表
sqlplus test/123456@orcl
CREATE TABLE test2(userId number(8), username varchar2(40), tep number (20)) PARTITION BY RANGE (userId)(PARTITION p1 VALUES LESS THAN (10000), PARTITION p2 VALUES LESS THAN (20000), PARTITION p3 VALUES LESS THAN (30000) );
查詢(xún)當(dāng)前用戶(hù)下的表:
select tname from tab;
成都創(chuàng)新互聯(lián)專(zhuān)注于企業(yè)全網(wǎng)整合營(yíng)銷(xiāo)推廣、網(wǎng)站重做改版、大同網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5開(kāi)發(fā)、商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營(yíng)銷(xiāo)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性?xún)r(jià)比高,為大同等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。
2.文件系統(tǒng)表空間遷移到ASM中去
rman target /
report schema; 查看表空間
sql 'alter tablespace test offline';離線(xiàn)表空間
backup as copy datafile 5 format '+DATA';Copy類(lèi)型備份表空間
switch datafile 5 to copy;切換表空間文件到copy副本
sql 'alter tablespace test online';上線(xiàn)表空間
report schema;
sqlplus / as sysdba
select ts#,name from v$tablespace where name='TEST' union all select file#,name from v$datafile where ts#=6;
select * from v$dbfile;
sqlplus test/123456@orcl
select tname from tab;