减小字体
增大字体
作者:佚名 来源:本站整理 发布时间:2009-03-16 13:49:52
一、进入oracle下# su - oracleas4101> lsnrctl startas4101> svrmgrlsvrmgrl> connect internal;svrmgrl> shutdown immediate;svrmgrl> startup二、查看有哪些表空间svrmgrl> SELECT * FROM DBA_TABLESPACES; SYSTEM RBS TEMP TOOLS USERS三、将USERS表空间DROPsvrmgrl> ALTER TABLESPACE USERS OFFLINE;svrmgrl> DROP TABLESPACE USERS;四、查看表空间的空余大小svrmgrl> SELECT TABLESPACE_NAME,SUM(BYTES)/1024/1024 MB FROM DBA_FREE_SPACE GROUP BY TABLESPACE_NAME;TABLESPACE_NAME MB------------------------------ ---------DD_DATA 1136.3672DD_IDX 787.18164JX_DATA 827.94531JX_IDX 503.16016RBS 371.9668SYSTEM 457.81445TEMP 1499.9961TOOLS 36.462891五、查看数据文件放置的路径svrmgrl> SELECT TABLESPACE_NAME,BYTES/1024/1024 MB,FILE_NAME FROM DBA_DATA_FILES;TABLESPACE_NAME MB FILE_NAME------------------------------ --------- ---------------SYSTEM 500 /dev/rdrd/drd4RBS 500 /dev/rdrd/drd14RBS 1000 /dev/rdrd/drd15RBS 500 /dev/rdrd/drd32TOOLS 50 /dev/rdrd/drd5TEMP 1000 /dev/rdrd/drd22TEMP 500 /dev/rdrd/drd23JX_DATA 500 /dev/rdrd/drd33六、对应SYSTEM表空间有一个回退段,为SYSTEM,另有一些回退段是属于RBS的, 先将RBS下的回退段都OFFLINE,并DROP,然后将RBS表空间DROP并重新创建, 最后,创建回退段。回退段4个,每个大小为RBS/4,这个值可以当作OPTIMAL值, 即等于INITIAL+NEXT*MAXEXTENTSsvrmgrl> ALTER ROLLBACK SEGMENT R01 OFFLINE;svrmgrl> DROP ROLLBACK SEGMENT R01;svrmgrl> alter tablespace rbs offline;svrmgrl> drop tablespace rbs;svrmgrl> Create TABLESPACE "RBS" DATAFILE '/dev/rdrd/rbs01.ora' SIZE 500M, '/dev/rdrd/rbs02.ora' SIZE 500M;svrmgrl> CREATE ROLLBACK SEGMENT "R01" TABLESPACE "RBS" STORAGE ( INITIAL 200M NEXT 2M OPTIMAL 250M MINEXTENTS 2 MAXEXTENTS 25);七、查看回退段及表空间的状态,若为ONLINE,即结束,为OFFLINE,要ONLINEsvrmgrl> select SEGMENT_NAME,TABLESPACE_NAME,status from DBA_ROLLBACK_SEGS;svrmgrl> ALTER ROLLBACK SEGMENT R01 ONLINE;八、临时表空间TEMP,先DROP,再重建。svrmgrl> alter tablespace temp offline;svrmgrl> drop tablespace temp;svrmgrl> CREATE TABLESPACE temp DATAFILE '/dev/rdrd/drd22' SIZE 1000M storage (initial 300m next 20m minextens 2 maxextents 35 pctincrease 0);九、工具表空间TOOLS大小为50M足够用,系统表空间SYSTEM为100M足够用。十、创建数据表空间: DD_DATA、DD_IDX、JX_DATA、JX_IDX、SF_DATA、SF_IDX、JF_DATA、JF_IDXsvrmgrl> CREATE TABLESPACE dd_data DATAFILE '/dev/rdrd/drd9' SIZE 1000M, '/dev/rdrd/drd10' SIZE 1000M, '/dev/rdrd/drd26' SIZE 1000M, '/dev/rdrd/drd35' SIZE 1000M, '/dev/rdrd/drd42' SIZE 500M;十一、创建用户svrmgrl> CREATE USER ddbh IDENTIFIED BY ddbh DEFAULT TABLESPACE dd_data TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON dd_data QUOTA UNLIMITED ON dd_idx QUOTA UNLIMITED ON rbs QUOTA UNLIMITED ON temp;十二、用户权限svrmgrl> grant connect,resources,imp_full_database,exp_full_database, create public synonym,drop public synonym to ddbh; 若要查看V$SESSION,KILL SESSION, DROP USER,CREATE USER等,则svrmgrl> grant select on v_$session to public;svrmgrl> grant alter system,drop user,create user to "*******";