Oracle DBA 基本语句

<!--[if !supportLists]-->一、     <!--[endif]-->修改共享池的大小:

SQL>alter system set shared_pool_size=32M scope=spfile;

<!--[if !supportLists]-->二、     <!--[endif]-->修改数据库高速缓冲区的大小:

SQL>alter system set db_cache_size=400M scope=spfile;

<!--[if !supportLists]-->三、     <!--[endif]-->打开高速缓冲区顾问工具(动态参数)

SQL>alter system set db_cache_advice=on;

SQL>select id,name,block_size,advice_status from v$db_cache_advice;

 

<!--[if !supportLists]-->四、     <!--[endif]-->内存缓冲区信息的获取

SQL>show parameter

//该命令显示出参数文件中可以设置的全部参数

获取SGA的相关信息:

SQL>show sga

<!--[if !supportLists]-->五、     <!--[endif]-->SQL*Plus 命令格式化输出

   SQL>col name from a20  //name 列的宽度为20个字符的宽度

   SQL>col value for a25

SQL>select name,type,value from v$parameter where name=’sga_max_size’;

//该语句显示SGA_MAX_SIZE的值大小。

<!--[if !supportLists]-->六、     <!--[endif]-->动态参数文件的建立:

   语法:

Create spfile [=’spfile name’] from pfile [=’pfile name’]

SQL>Create spfile from pfile

 //使用默认的pfile文件产生一个默认的spfile文件。

<!--[if !supportLists]-->七、     <!--[endif]-->使用spfile 文件常见pfile文件

SQL>create pfile from spfile;

<!--[if !supportLists]-->八、     <!--[endif]-->将数据库置为限制模式

<!--[if !supportLists]-->1)     <!--[endif]-->SQL>startup restrict;

<!--[if !supportLists]-->2)     <!--[endif]-->SQL>alter system enable restricted session;

//把一运行的数据库状态置为限制模式

<!--[if !supportLists]-->3)       <!--[endif]-->SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION

//取消限制模式

<!--[if !supportLists]-->九、     <!--[endif]-->让服务器产生用户跟踪文件,SQL_trace (动态参数)

SQL>alter session set sql_trace=true;

SQL>alter session set sql_trace=false; //停止跟踪

<!--[if !supportLists]-->十、     <!--[endif]-->获取数据库的名字等信息

   SQL> select name,created,log_mode,open_mode from v$database;

<!--[if !supportLists]-->十一、              <!--[endif]-->获取数据库服务器的主机名

SQL>select host_name,instance_name,version from v$instance;

<!--[if !supportLists]-->十二、              <!--[endif]-->控制文件的路径:

SQL>select * from v$controlfile;

<!--[if !supportLists]-->十三、              <!--[endif]-->获取重做日志文件的信息

SQL>select group#,members,bytes,status,archived from v$log;

<!--[if !supportLists]-->十四、              <!--[endif]-->重做日志文件所放的位置:

   SQL>select * from v$logfile;

<!--[if !supportLists]-->十五、              <!--[endif]-->检查oracle 是否有使用归档日志

SQL>archive log list

<!--[if !supportLists]-->十六、              <!--[endif]-->了解数据库服务器的表空间的情况和位置

   SQL>col tablespace_name for a15

   SQL>select tablespace_name,block_size,status,contents,logging from dba_tablespaces;

<!--[if !supportLists]-->十七、              <!--[endif]-->了解每个表空间的命名等信息:

   SQL>select file_id,file_name,tablespace_name,status,bytes from dba_data_files;

<!--[if !supportLists]-->十八、              <!--[endif]-->了解oracle数据库上有多少个用户;

SQL>select username,created from dba_users;

<!--[if !supportLists]-->十九、              <!--[endif]-->怎样查看控制文件的配置

SQL>select type,record_size,records_total,records_used from v$controlfile_record_section;

Record_size:为每个记录的字节数;

Records_total:为该段所分配的记录个数;

Records_used:为该段所使用的记录个数。
posted on 2008-03-03 22:59  一江水  阅读(408)  评论(0编辑  收藏  举报