问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

oracle的归档日志如何分天存放

发布网友 发布时间:2022-04-11 07:38

我来回答

4个回答

热心网友 时间:2022-04-11 09:07

中文打字太慢,所以就用英文回答。

The answer by the first respondent is totally wrong. ARCHIVELOG/NONARCHIVELOG has nothing to do with what you ask for. ARCHIVELOG/NONARCHIVELOG is about the recoverbility of the database, but what you want is "Auditing" in Oracle, which is about monitoring users' activities in database.

The auditing mechanism for Oracle is extremely flexible, so I'll only talk about performing full auditing on a single user.

1. Database server setup

To allow auditing on the server you must:

Set "audit_trail = true" in the init.ora file.
Run the $ORACLE_HOME/rdbms/admin/cataudit.sql script while connected as SYS.

2. Audit Options

Assuming that the "AAA" user is to be audited:

CONNECT sys/password AS SYSDBA

AUDIT ALL BY AAA BY ACCESS;
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY AAA BY ACCESS;
AUDIT EXECUTE PROCEDURE BY AAA BY ACCESS;

These options audit all DDL and DML issued by "AAA", along with some system events.

DDL (CREATE, ALTER & DROP of objects)
DML (INSERT UPDATE, DELETE, SELECT, EXECUTE).
SYSTEM EVENTS (LOGON, LOGOFF etc.)

3. View Audit Trail

The audit trail is stored in the SYS.AUD$ table. It's contents can be viewed directly or via the following views:

DBA_AUDIT_EXISTS
DBA_AUDIT_OBJECT
DBA_AUDIT_SESSION
DBA_AUDIT_STATEMENT
DBA_AUDIT_TRAIL
DBA_OBJ_AUDIT_OPTS
DBA_PRIV_AUDIT_OPTS
DBA_STMT_AUDIT_OPTS

The audit trail contains a lot of data, but the following are most likely to be of interest:

Username: Oracle Username.
Terminal: Machine that the user performed the action from.
Timestamp: When the action occured.
Object Owner: The owner of the object that was interacted with.
Object Name: The name of the object that was interacted with.
Action Name: The action that occured against the object. (INSERT, UPDATE, DELETE, SELECT, EXECUTE)

4. Maintenance

The audit trail must be deleted/archived on a regular basis to prevent the SYS.AUD$ table growing to an unnacceptable size.

5. Security

Only DBAs should have maintenance access to the audit trail. Auditing modifications of the data in the audit trail itself can be achieved as follows:

AUDIT INSERT, UPDATE, DELETE ON sys.aud$ BY ACCESS;
另外,团IDC网上有许多产品团购,便宜有口碑追问此人是废话,答非所问

热心网友 时间:2022-04-11 10:25

中文打字太慢,所以就用英文回答。

The answer by the first respondent is totally wrong. ARCHIVELOG/NONARCHIVELOG has nothing to do with what you ask for. ARCHIVELOG/NONARCHIVELOG is about the recoverbility of the database, but what you want is "Auditing" in Oracle, which is about monitoring users' activities in database.

The auditing mechanism for Oracle is extremely flexible, so I'll only talk about performing full auditing on a single user.

1. Database server setup

To allow auditing on the server you must:

Set "audit_trail = true" in the init.ora file.
Run the $ORACLE_HOME/rdbms/admin/cataudit.sql script while connected as SYS.

2. Audit Options

Assuming that the "AAA" user is to be audited:

CONNECT sys/password AS SYSDBA

AUDIT ALL BY AAA BY ACCESS;
AUDIT SELECT TABLE, UPDATE TABLE, INSERT TABLE, DELETE TABLE BY AAA BY ACCESS;
AUDIT EXECUTE PROCEDURE BY AAA BY ACCESS;

These options audit all DDL and DML issued by "AAA", along with some system events.

DDL (CREATE, ALTER & DROP of objects)
DML (INSERT UPDATE, DELETE, SELECT, EXECUTE).
SYSTEM EVENTS (LOGON, LOGOFF etc.)

3. View Audit Trail

The audit trail is stored in the SYS.AUD$ table. It's contents can be viewed directly or via the following views:

DBA_AUDIT_EXISTS
DBA_AUDIT_OBJECT
DBA_AUDIT_SESSION
DBA_AUDIT_STATEMENT
DBA_AUDIT_TRAIL
DBA_OBJ_AUDIT_OPTS
DBA_PRIV_AUDIT_OPTS
DBA_STMT_AUDIT_OPTS

The audit trail contains a lot of data, but the following are most likely to be of interest:

Username: Oracle Username.
Terminal: Machine that the user performed the action from.
Timestamp: When the action occured.
Object Owner: The owner of the object that was interacted with.
Object Name: The name of the object that was interacted with.
Action Name: The action that occured against the object. (INSERT, UPDATE, DELETE, SELECT, EXECUTE)

4. Maintenance

The audit trail must be deleted/archived on a regular basis to prevent the SYS.AUD$ table growing to an unnacceptable size.

5. Security

Only DBAs should have maintenance access to the audit trail. Auditing modifications of the data in the audit trail itself can be achieved as follows:

AUDIT INSERT, UPDATE, DELETE ON sys.aud$ BY ACCESS;
另外,虚机团上产品团购,超级便宜

热心网友 时间:2022-04-11 12:00

实在看不下去楼上两位不知所云的东西,你们回答的和别人问的是一回事吗?无聊。
实际上archivlog论天来存放没有什么意义啊?你的目的是什么呢?不行的话就修改db_recovery_file_dest 路径嘛,改到你希望的地方去。追问安装好oracle归档日志默认是按天保存的,一天自动生成一个文件夹保存当前的日志,
我修改归档日志位置后,就不按天生成日志文件夹了,日志都在一个文件夹中,很奇怪?

我想修改归档日志位置后,还让归档日志按天生成文件夹,

不按天生成日志文件夹也可以用,分天只是看着清晰明了

追答如果你一定要这么做的话,那只有手工来改咯,写个shell每天晚上0点执行:
#!/bin/ksh
TIME=`date +%Y%m%d`
mkdir $ORACLE_HOME/flash_recovery_area/test/archivelog/$TIME
sqlplus "/as sysdba" <<!
alter system set log_archive_dest_1='LOCATION=$ORACLE_HOME/flash_recovery_area/test/archivelog/';
exit
!
这样你的日志就能分天存放了,不过这样会带来以下问题:
1、如果脚本执行失败可能导致:因为不能切换redolog而产生的数据库问题。
2、你的备份脚本需要重新修改(对备份时间修改,或者对备份target目录修改)
3、你的数据库如果需要恢复,那将会是相当痛苦的事情。特别是很多天的备份都未成功时。

实际上archivelog主要的用途是数据库内部使用,你总不可能每天使用logminer吧?对数据库而言archivelog不论放在哪都是清晰的(经常修改了反而不清晰了),对你来说可能好看了,但是对数据库来说实用性恐怕为零。另外如果要统计每天的日志量,或者日志个数,对dba来说有很多方法,不见得非要每天都生成目录。

当然了,可能是我还学习得不够深入,也许还有其它办法我不知道或者没想到的。

热心网友 时间:2022-04-11 13:51

我也想知道,今天刚刚改过目录,就不知道了。
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
电脑wifi已禁用怎么打开电脑无线网络禁用了怎么恢复 ...禁用网络在哪重开win7笔记本无线网络被禁用了怎么办 win7网络禁用怎么恢复 windows7网络被禁用怎么恢复 Win7系统本地连接禁用了怎么恢复Win7系统启动本地连接的两种方法图文... 梦见家人去世什么预兆 ...经缝针现在基本痊愈,一个月过去了现在就是小腿还不能贴大腿,最近感... 小腿缝针拆线三个月了表皮长好了里面的肉怎么有点带黑红色还有点白色... 小腿迎面骨掉快深宽都1厘米左右的肉。当时没缝针。已经20天了。天天... 运费和快递费各走 什么科目? 快递费用放什么科目 不锈钢圆管怎么固定钢化玻璃? 2米高的玻璃怎样固定 手机热点打开后再充电是否会延长充电时间? 开着热点充电,会影响电池寿命吗 如何将华为手机设置充电开机后自动打开手机热点目的就是让旧手机当做热点手机 我的型号是r15 ,充电的时候能开热点吗 一转眼间,我从一个不懂事的孩子,变成了一个懂事的孩子,我要感 第3自然段中的调皮,不懂事写出了歌溪什么特点? 如何去除窗帘甲醛? 新窗帘多多少少都会有异味,窗帘甲醛如何去除 新窗帘怎么洗去甲醛 关于窗帘去甲醛,怎么去除? 新买的窗帘怎样简单有效去除甲醛残留 手机进自己QQ空间的网址是什么啊 oracle 怎么查看归档日志 优立塑减肥价格 有用过芸茜 Rinsey液态优立塑的吗?效果怎么样? 干细胞能用于美容吗 优立素操作者需要医师资格证吗 优立塑(欧萃学)和热立塑有什么区别? 谁有美剧时空游侠的第一。二。三季。。发个百度网盘连接下载 时空游侠好看吗? 求一篇两会心得 80年代陪伴我们的那些动画片你知道哪些? 求几篇2008年的入党思想汇报 有关两会的论文 2K字左右~~内容是两会就好~~· 关于两会和科学发展观的心得 学习科学发展观第二阶段心得体会? 两会细微镜头大情怀作文900字? 关注两会有什么意义 202565是什么股票?为什么我百度查有这个票,股票交易软件查没有这个股票呢?怎么是20开头的啊? 可以通过微信支付码找到这个人的吗? 如何通过微信扫码支付找到支付人?- 问一问 微信收款后怎么查到对方? 用微信直接支付,如何找到对方的? 顾客到店扫二维码付款少付了,怎么怎么找到他的? 微信扫一扫付款后能查到对方的吗? 微信二维码付款给对方可以找到对方吗? 怎样查看扫二维码付款人的? 可以通过微信支付码找到这个人的吗