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;