用户与表空间的管理

 

一、创建用户user1
SQL>create user identified by oracle
     Default tablespace users
     Temporary tablespace temp
     Quota 10m on users
二、日志文件
1、创建一个日志组
SQL>alter database add logfile group 4
‘/db/oracle/oradata/yang/redo04.log’ size 4m;
2、增加一个日志成员
SQL>alter database add logfile member
‘/db/oracle/oradata/yang/redo011.log’ to group 1;
3、删除日志组
SQL>alter database drop logfile group 1;
4、删除日志组成员
SQL>alter database drop logfile member
‘/db/oracle/oradata/yang/redo044.log’;
5、查看命令
SQL>select member from v$logfile;
SQL>select group#,member from v$logfile order by group#;
二、表空间
1、创建表空间
SQL>create tablespace users1 datafile
     ‘/db/oracle/oradata/yang/users101.dbf’
     Size 10m autoextend on next 1m maxsize unlimited;
2、删除表空间
SQL>drop tablespace users1 including contents and datafiles;
3、扩张表空间大小
SQL>alter tablespace users1 add datafile
     ‘/db/oracle/oradata/yang/users102.dbf’ size 50m;
SQL>alter database datafile ‘/db/oracle/oradata/yang/users101.dbf’
      Resize 100m;
SQL>alter database datafile  ‘/db/oracle/oradata/yang/users101.dbf’
     Autoextend on next 1m maxsize unlimited;
4、查看命令
查看表空间与数据文件的对应关系
SQL>select tablespace_name,file_name from dba_data_files;
查看表空间的总大小
SQL>select tablespace_name sum(bytes/1024/1024)from dba_data_files
     Group by tablespace_name;
查看表空间的剩余大小
SQL>select tablespace_name,sum(bytes/1024/1024) from
dba_free_space group by tablespace_name;
查看数据文件的大小
SQL>select name,bytes from v$datafile;
 
 

你可能感兴趣的:(oracle,用户,空间)