经典推荐: Oracle 常用命令汇总
//创建一个控制文件命令到跟踪文件
alter database backup controlfile to trace;
//增加一个新的日志文件组的语句
connect internal as sysdba
alter database
add logfile group 4
('/db01/oracle/CC1/log_1c.dbf',
'/db02/oracle/CC1/log_2c.dbf') size 5M;
alter database
add logfile member '/db03/oracle/CC1/log_3c.dbf'
to group 4;
//在Server Manager上MOUNT并打开一个数据库:
connect internal as sysdba
startup mount ORA1 exclusive;
alter database open;
//生成数据字典
@catalog
@catproc
//在init.ora 中备份数据库的位置
log_archive_dest_1 = '/db00/arch'
log_archive_dest_state_1 = enable
log_archive_dest_2 = "service=stby.world mandatory reopen=60"
log_archive_dest_state_2 = enable
//对用户的表空间的指定和管理相关的语句
create user USERNAME identified by PASSWORD
default tablespace TABLESPACE_NAME;
alter user USERNAME default tablespace TABLESPACE_NAME;
alter user SYSTEM quota 0 on SYSTEM;
alter user SYSTEM quota 50M on TOOLS;
create user USERNAME identified by PASSWORD
default tablespace DATA
temporary tablespace TEMP;
alter user USERNAME temporary tablespace TEMP;
//重新指定一个数据文件的大小 :
alter database
datafile '/db05/oracle/CC1/data01.dbf' resize 200M;
//创建一个自动扩展的数据文件:
create tablespace DATA
datafile '/db05/oracle/CC1/data01.dbf' size 200M
autoextend ON
next 10M
maxsize 250M;
//在表空间上增加一个自动扩展的数据文件:
alter tablespace DATA
add datafile '/db05/oracle/CC1/data02.dbf'
size 50M
autoextend ON
maxsize 300M;
//修改参数:
alter database
datafile '/db05/oracle/CC1/data01.dbf'
autoextend ON
maxsize 300M;
//在数据文件移动期间重新命名:
alter database rename file
'/db01/oracle/CC1/data01.dbf' to
'/db02/oracle/CC1/data01.dbf';
alter tablespace DATA rename datafile
'/db01/oracle/CC1/data01.dbf' to
'/db02/oracle/CC1/data01.dbf';
alter database rename file
'/db05/oracle/CC1/redo01CC1.dbf' to
'/db02/oracle/CC1/redo01CC1.dbf';
alter database datafile '/db05/oracle/CC1/data01.dbf'
resize 80M;