Oracle10G常用维护语句汇总

1 创建表空间

View Code
1 CREATE TABLESPACE CPORTAL LOGGING DATAFILE '/dev/raw/raw1' SIZE 30000M REUSE EXTENT MANAGEMENT LOCAL


2 创建用户

View Code
1 CREATE USER CPORTAL PROFILE DEFAULT IDENTIFIED BY CPORTAL DEFAULT
2
3 TABLESPACE CPORTAL TEMPORARY TABLESPACE TEMP ACCOUNT UNLOCK;
4
5 GRANT CONNECT TO CPORTAL;
6
7 GRANT RESOURCE TO CPORTAL;


3 参数修改

View Code
 1 ALTER SYSTEM SET sga_target 1000M SCOPESPFILE;
2
3 ALTER SYSTEM SET pga_aggregate_target 200M SCOPESPFILE;
4
5 ALTER SYSTEM SET OPEN_CURSORS500 SCOPESPFILE;
6
7 ALTER SYSTEM SET processes200 SCOPESPFILE;
8
9 ALTER SYSTEM SET remote_login_passwordfile NONE
10
11 SCOPESPFILE;
12
13 create pfile from spfile;
14
15 -- Modify the other oracle parameter!
16
17 ALTER DATABASE TEMPFILE '/opt/oracle/oradata/cportal/temp01.dbf' RESIZE 1024M;
18
19 ALTER DATABASE DATAFILE '/opt/oracle/oradata/cportal/undotbs01.dbf' RESIZE 1024M;
20
21 ALTER DATABASE DATAFILE '/opt/oracle/oradata/cportal/undotbs01.dbf' AUTOEXTEND ON MAXSIZE 10240M


4 查看表空间名称和大小

View Code
1 select t.tablespace_name,round(sum(bytes/(1024*1024)),0) ts_size from dba_tablespaces t dba_data_files d
2
3 where t.tablespace_name = d.tablespace_name
4
5 group by t.tablespace_name;


5 查看表空间的使用情况

View Code
1 select sum(bytes)/(1024*1024)as free_space,tablespace_name from dba_free_spacegroup by tablespace_name;

 

6、查看表空间物理文件的名称及大小

View Code
1 select tablespace_name,file_id,file_name,
2
3 round(bytes/(1024*1024),0) total_space
4
5 from dba_data_files
6
7 order by tablespace_name;


7、查看数据库库对象

View Code
1 select owner,object_type,status,count(*)count# from all_objects group by owner,object_type,status;


8、查看控制文件

View Code
1 select name from v$controlfile;


9、查看日志文件

View Code
1 select member from v$logfile;


10 、结束用户会话

View Code
1 alter system kill session 'SID,SERIAL#';
2
3 select sid,serial#,username,program,machine,status from v$session;


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值