1、先要了解当前的
Oracle数据库的版本和平台和相关信息 下面的这些脚本可以帮助你获取你需要的相关信息。
A,
SQL>select * from v$version;
B,
SQL>select dbid, name, open_mode, database_role, platform_name from v$database;
C,
SQL>select * from v$instance;
D,
SQL>select dbms_utility.port_string from dual;
E,
SQL>set serveroutput on
declare
ver VARCHAR2(100);
compat VARCHAR2(100);
begin
dbms_utility.db_version(ver, compat);
dbms_output.put_line('Version: ' ver ' Compatible: ' compat);
end;
/
Version: 10.2.0.1.0 Compatible: 10.2.0.1.0
PL/SQL procedure successfully completed
2、其次要了解你的数据库中装了哪些组件
A,
SQL>select * from dba_registry;
3、搞清楚这个环境是单机还是集群?
这个判断方法很多,这里给出一个借助dbms_utility来判断的方法。
SQL>set serveroutput on
declare
inst_tab dbms_utility.instance_table;
inst_cnt NUMBER;
begin
if dbms_utility.is_cluster_database then dbms_utility.active_instances(inst_tab, inst_cnt);
dbms_output.put_line('-' inst_tab.FIRST);
dbms_output.put_line(TO_CHAR(inst_cnt));
else
dbms_output.put_line('Not A Clustered Database'); end if;
end; /
Not A Clustered Database
PL/SQL procedure successfully completed
SQL>select protection_mode, protection_level, remote_archive, database_role, dataguard_broker,guard_statusfrom v$database;
5、是否起用了归档模式?
A,
SQL>conn /as sysdba
B,
SQL>archive log list;
C,
SQL>select log_mode from v$database;
SQL>show parameter log_archive_dest
6、是否起用了flashback database特性?
SQL>select flashback_on from v$database;
如果是,再进一步查看FLASHBACK RECOVERY AREA的配置情况
SQL> show parameter db_recovery_file_dest;
SQL> show parameter db_recovery_file_dest_size;
7、是否起用了force logging和补充日志?
SQL>select force_logging,supplemental_log_data_min, supplemental_log_data_pk, supplemental_log_data_ui,supplemental_log_data_fk,supplemental_log_data_all
from v$database;
8、了解控制文件的组成
SQL>select * from v$controlfile;
9、了解日志文件的组成
SQL>select l.group#, lf.type,lf.member,l.bytes,l.status LOG_STATUS,lf.status LOGFILE_STATUS from v$log l,v$logfile lf where l.group# = lf.group#order by 1,3;
10、了解参数文件的组成和位置
SQL> show parameter spfile
create spfile from pfile...
create pfile from spfile;
create spfile from memory;
create pfile from memory;
11、表空间和数据文件的规划
SQL> select ts.name tablespace_name,df.name datfile_name,df.status,df.enabled,df.bytes,df.blocks from v$DATAfile df,v$tablespace ts where df.ts#=ts.ts#;
SQL> select * from v$tablespace;
SQL> select * from v$datafile;
12、了解instance的相关信息
SQL> select instance_name, host_name, status, archiver, database_status, instance_role, active_state from v$instance;
13、字符集相关
SQL> select * from database_properties;
SQL> select parameter,value from nls_database_parameters where parameter like '%CHARACTERSET%';
14、是否打开了BLOCK CHANGE TRACKING
SQL> select filename, status, bytes from v$block_change_tracking;
15、起用了那些特性(Feature)?
方案一、
set serveroutput on spool
/home/oracle/backup/usage_report.html
SELECT output FROM
TABLE(dbms_feature_usage_report.display_html);
spool off
方案二、
set serveroutput on spool
/home/oracle/backup/usage_report.txt
SELECT output FROM TABLE(dbms_feature_usage_report.display_text);
spool off
16、系统中是否存在invalid对象
SQL> select owner, object_type,COUNT(*) from dba_objects where status = 'INVALID' group by owner,object_type;
SQL> @?/rdbms/admin/utlrp.sql
SQL> select owner,object_name
from dba_objects
where status = 'INVALID';
17、更进一步的
A,网络文件的配置是如何的?
[oracle@localhost ~]$ vi $ORACLE_HOME/network/admin/listener.ora
[oracle@localhost ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora[oracle@localhost ~]$ vi $ORACLE_HOME/network/admin/sqlnet.ora
[oracle@localhost ~]$ lsnrctl status
B,
是否使用了ASM?
C,
冷备份、热备份
部分库备份、全库备份
逻辑备份、物理备份
18、查看一下最近的alert日志,获取一些有用的信息
SQL> show parameter dump_dest
[oracle@localhost ~]$ vi $ORACLE_BASE/admin/orcl/bdump/alert_<SID>.log
19、跑几个性能分析报告,看看最近系统的运行状态如何
方案一、
SQL> select * from dba_hist_snapshot order by snap_id desc;
SQL> dbms_workload_repository.create_snapshot();
SQL> dbms_workload_repository.create_baseline(start_snap_id=>49,end_snap_id=>50,baseline_name=> 'bn20090908');
方案二、
Enterprise manager->awr->snapshot
Enterprise manager->addm
20、跑一个RDA报告,收集完整的系统状态报告
[root@localhost rda]cd
[root@localhost rda]#./rda.sh –S
[root@localhost rda]#./rda.sh -v
好了,有了这一些基本信息(不完全),你基本上对你新接触的这个系统有了一个大概的了解,接来下,你再慢慢的深入分析,然后制订出一套符合实际情况的运维规范来。
21、用户和密码相关
是否使用了缺省密码?
是否使用了profile?
是否起用了密码验证函数?
用户身份验证的方法?
密码是否区分大小写等。
A,
SQL>select name, value from gv$parameter where name = 'resource_limit';
B,
SQL>select profile, resource_name, limit from dba_profiles order by 1,2;
C,
SQL>select username, profile from dba_users where account_status = 'OPEN' order by 1;
D,
SQL>select d.username, u.account_status from dba_users_with_defpwd d,dba_users u where d.username = u.username and account_status = 'OPEN' order by 2,1;
22、检查 dba_jobs 及 dba_scheduler_jobs
SQL>select job,schema_user,last_date,last_sec,this_date,this_sec,next_date,next_sec,total_time From dba_jobs;
SQL>select owner,job_name,program_owner,program_name,start_date,end_date,run_count From dba_scheduler_jobs;
23 检查 database event trigger(startup, logon 等等)
select owner,trigger_name,triggering_event from dba_triggers where trigger_type in ('BEFORE EVENT', 'AFTER EVENT');