数据库与用户操作日志
游戏里,需要把用户操作的日志存储在数据库里面,问题是,怎样同步数据库?总不能用户每一步操作后,都要更新数据库吧......
游戏里,需要把用户操作的日志存储在数据库里面,问题是,怎样同步数据库?总不能用户每一步操作后,都要更新数据库吧...
展开
2个回答
展开全部
中文打字太慢,所以就用英文回答。
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;
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;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
美林数据技术股份有限公司
2020-10-29 广告
2020-10-29 广告
Tempo大数据分析平台,是一款面向企业用户的数据分析与应用工具,为用户提供报表设计、可视化分析、机器学习、文本分析等自助式数据分析与探索。平台基于大数据架构,集数据接入、数据分析探索、成果管理与应用为一体,面向企业全民用户提供从数据到业务...
点击进入详情页
本回答由美林数据技术股份有限公司提供
2011-01-13 · 知道合伙人软件行家
关注
展开全部
你可以写入命令啊!很多主流数据库都有系统日志功能,都是写出来的!你可以进程序网看看!
如果你对代码感兴趣,你可以baidu一下就出来了。什么vba,vc,vc++,一大堆。你要知道,游戏是被开发出来的,肯定有一个开发平台。只不过大型游戏都是几个团队在开发,耗时也长,还得调试。
随着计算机普及,很多语言都出来了,国家也鼓励社会人员参加计算机等级考试!
如果你对代码感兴趣,你可以baidu一下就出来了。什么vba,vc,vc++,一大堆。你要知道,游戏是被开发出来的,肯定有一个开发平台。只不过大型游戏都是几个团队在开发,耗时也长,还得调试。
随着计算机普及,很多语言都出来了,国家也鼓励社会人员参加计算机等级考试!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询