1. 修改用户 sys/system/scott/sys_man(oem使用)的密码;
2. 进入dba studio看看系统有多少个用户,有没有可疑用户
3. 不用随便给普通用户赋予DBA角色,普通用户赋予CONNECT或
RESOURCE角色或者根据需要赋予相关的权限。
4. 8i以上使用LogMiner工具,关于此工具的使用查阅精华区或faqs
5. 经常查看Alert
1<sid>.log文件,该文件路径: $ORACLE_HOME\admin\sid\bdump.
2
3
4用LogMiner包看一下,可以看到他是用的那个用户修改的那些表修改了什么。
5Example of Using LogMiner
6Assume that the data dictionary extract was taken to a flat file named
7'/usr/oracle/dbs/dict.txt'
8The DBA first specifies five redo logs to be analyzed
9execute dbms_logmnr.add_logfile (filename => '/usr/oracle/dbs/arch123.dbf',
10options => dbms_logmnr.NEW);
11\-- identifying this file starts a new list of files to analyze
12execute dbms_logmnr.add_logfile (filename => '/usr/oracle/dbs/arch124.dbf',
13options => dbms_logmnr.ADDFILE);
14execute dbms_logmnr.add_logfile (filename => '/usr/oracle/dbs/arch125.dbf',
15options => dbms_logmnr.ADDFILE);
16execute dbms_logmnr.add_logfile (filename => '/usr/oracle/dbs/arch126.dbf',
17options => dbms_logmnr.ADDFILE);
18execute dbms_logmnr.add_logfile (filename => '/usr/oracle/dbs/arch127.dbf',
19options => dbms_logmnr.ADDFILE);
20The DBA then specifies the location of the dictionary with,
21execute dbms_logmnr.start_logmnr( dictfilename => '/usr/oracle/dbs/dict.txt' );
22The DBA is now ready to issue a select against the v$logmnr_contents view
23select operation, sql_redo, sql_undo
24from v$logmnr_contents
25where seg_owner = 'SCOTT' and seg_name = 'ORDERS' and
26operation = 'DELETE' and username = 'RON';
27
28listner.log 里面会有你想要的证据
29
30查listener.log只能查到从哪里登录,查不到输入什么sql语句。
31保密有一点很关键但又很容易被忽略的,很多人都是直接输入
32sqlplus username/password@connstring (一般服务器都安装在unix系统)
33登录的,如此一来,别人只要用ps -ef|grep sqlplus就可以看到你的用户名和密码了。
34应该用
35sqlplus 然后再输入用户名和密码。
36也可以先定义一个变量
37$STRI=username/password;export $STRI
38sqlplus $STRI@connstring
39这样别人就看不到你的密码了。
40
41
42注意查看system的视图v$sql,也许会有收获。
43
44当然用审计功能 :
45方法一:
46用以下的方式可以監控登入登出的用戶:
47創建如下的兩張表:
48create table login_log -- 登入登出信息表
49(
50session_id int not null, -- sessionid
51login_on_time date, -- 登入時間
52login_off_time date, -- 登出時間
53user_in_db varchar2(30), -- 登入的db user
54machine varchar2(20), -- 機器名
55ip_address varchar2(20), -- ip地址
56run_program varchar2(20) -- 以何程序登入
57);
58
59create table allow_user -- 網域用戶表
60(
61ip_address varchar2(20), -- ip地址
62login_user_name nvarchar2(20) -- 操作者姓名
63);
64
65創建如下的兩個觸發器:
66create or replace trigger login_on_info -- 紀錄登入信息的觸發器
67after logon on database
68Begin
69insert into login_log(session_id,login_on_time,login_off_time,user_in_db,machine,ip_address,run_program)
70select AUDSID,sysdate,null,sys.login_user,machine,SYS_CONTEXT('USERENV','IP_ADDRESS'),program
71from v$session where AUDSID = USERENV('SESSIONID'); --當前SESSION
72END;
73
74create or replace trigger login_off_info -- 紀錄登出信息的觸發器
75before logoff on database
76Begin
77update login_log set login_off_time = sysdate
78where session_id = USERENV('SESSIONID'); --當前SESSION
79exception
80when others then
81null;
82END;
83
84方法二:
85用如下的方式可以審計執行drop動作的事件:
86/**
87* drop語句的審計日誌表
88*/
89create table drop_log
90(
91session_id int not null, -- sessionid
92drop_time date, -- drop的時間
93ip_address varchar2(20), -- ip地址
94object_owner varchar2(30), -- 對象的擁有者
95object_name varchar2(30), -- 對象名稱
96object_type varchar2(20), -- 對象類型
97drop_by_user varchar2(30) -- 執行drop語句的用戶
98);
99
100create or replace trigger drop_info
101after drop on mfg0513user.schema -- 在mfg0513user用戶上創建審計drop的觸發器
102begin
103insert into drop_log
104(session_id,
105drop_time,
106ip_address,
107object_owner,
108object_name,
109object_type,
110drop_by_user)
111values(USERENV('SESSIONID'),
112sysdate,
113SYS_CONTEXT('USERENV','IP_ADDRESS'),
114sys.dictionary_obj_owner,
115sys.dictionary_obj_name,
116sys.dictionary_obj_type,
117sys.login_user);
118end;
119
120
121To collect auditing results, you must set the initialization parameter AUDIT_TRAIL to DB.
122To choose auditing for statements issued by the users aaa that query or update a table or view, issue the following statement:
123AUDIT SELECT TABLE, UPDATE TABLE
124BY aaa;
125To obtaining information:
126\--DBA_AUDIT_TRAIL
127\--DBA_AUDIT_EXISTS
128\--DBA_AUDIT_OBJECT
129\--DBA_AUDIT_SESSION
130\--DBA_AUDIT_STATEMENT</sid>