189 8069 5689

怎么开启oracle日志,oracle 日志

在ORACLE 中怎么查看SQL 执行日志

1、首先打开oracle sql developer工具,没有此工具的可以去百度浏览器下载安装即可,鼠标点击查看菜单。

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册雅安服务器托管、营销软件、网站建设、且末网站维护、网站推广。

2、在二级菜单中,选择SQL历史记录选项,或者按快捷键F8打开窗口。

3、默认打开是会显示在最下方的小窗口,在标题栏双击鼠标左键,即可最大化窗口,再次双击左键还原窗口。

4、最大化窗口之后,便于更好的查询记录结果,可以看到,以往执行的sql记录都显示出来了可以往下翻动,查询自己需要的日志。

oracle 如何关闭打开归档日志的方法

查看oracle数据库是否为归档模式

SQL select name,log_mode from V$database;

NAME LOG_MODE

------------------ ------------------------

TEST NOARCHIVELOG

SQL archive log list

Database log mode No Archive Mode

Automatic archival Disabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 80157

Current log sequence 80163

编辑本段配置数据库的.归档模式

1.改变非归档模式到归档模式:

1)SQL conn / as sysdba (以DBA身份连接数据库)

2)SQL shutdown immediate;(立即关闭数据库)

3)SQL startup mount (启动实例并加载数据库,但不打开)

4)SQL alter database archivelog; (更改数据库为归档模式)

5)SQL alter database open; (打开数据库)

6)SQL alter system archive log start; (启用自动归档)

7)SQL exit (退出)

做一次完全备份,因为非归档日志模式下产生的备份日志对于归档模式已经不可用了.这一步非非常重要!

2.改变归档模式到非归档模式:

1)SQLSHUTDOWN NORMAL/IMMEDIATE;

2)SQLSTARTUP MOUNT;

3)SQLALTER DATABASE NOARCHIVELOG;

4)SQLALTER DATABASE OPEN;

3.归档相关命令

archive log stop;

archive log start;

archive log list;

show parameters;

show parameters log_archive_start;

show parameters log_archive_max_process; #归档进程数

alter system set log_archive_max_process=5; #将归档进程数改为5

select * from v$bgprocess; #检察后台进程

如何启动Oracle的监听日志

启动监听日志的步骤如下:

1.首先查看当前监听的状态

[oracle@oel ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 01-JUL-2012 13:29:58

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel)(PORT=1521)))

STATUS of the LISTENER

————————

Alias listener

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date 01-JUL-2012 13:12:51

Uptime 0 days 0 hr. 17 min. 7 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listening Endpoints Summary…

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary…

Service “orcl” has 1 instance(s).

Instance “orcl”, status READY, has 1 handler(s) for this service…

Service “orclXDB” has 1 instance(s).

Instance “orcl”, status READY, has 1 handler(s) for this service…

The command completed successfully

从上面显示信息来看,我们监听正常。并且没有看到Listener Log File的信息。

2.进入监听配置,查看监听详细信息

[oracle@oel ~]$ lsnrctl –进入监听配置

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 01-JUL-2012 13:35:00

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Welcome to LSNRCTL, type “help” for information.

LSNRCTL show –查看监听参数信息

The following operations are available after show

An asterisk (*) denotes a modifier or extended command:

rawmode displaymode

rules trc_file

trc_directory trc_level

log_file log_directory

log_status current_listener

inbound_connect_timeout startup_waittime

snmp_visible save_config_on_stop

dynamic_registration enable_global_dynamic_endpoint

oracle_home pid

connection_rate_limit

LSNRCTL show log_status –查看监听日志状态

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel)(PORT=1521)))

LISTENER parameter “log_status” set to OFF

The command completed successfully

上面信息显示Listener parameter “log_status” set to OFF说明监听日志是关闭的。这是时候我们需要启动监听日志。

3.设置当前监听,如果有多个监听,在修改监听配置的时候需要指定某个具体的监听,我这里只有一个默认的Listener,所以不需要设置。我这里还是演示一下。

LSNRCTL show current_listener

Current Listener is LISTENER

LSNRCTL set current_listener Listener

Current Listener is Listener

LSNRCTL show current_listener

Current Listener is Listener

4.启动监听日志,并且保存配置信息

LSNRCTL set log_status on –设置监听日志状态为on

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel)(PORT=1521)))

LISTENER parameter “log_status” set to ON

The command completed successfully

LSNRCTL save_config –保存监听配置

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel)(PORT=1521)))

Saved listener configuration parameters.

Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Old Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.bak

The command completed successfully

5.在查看监听状态

[oracle@oel ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 01-JUL-2012 13:44:32

Copyright (c) 1991, 2011, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oel)(PORT=1521)))

STATUS of the LISTENER

————————

Alias listener

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date 01-JUL-2012 13:12:51

Uptime 0 days 0 hr. 31 min. 41 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/oel/listener/alert/log.xml

Listening Endpoints Summary…

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oel)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary…

Service “orcl” has 1 instance(s).

Instance “orcl”, status READY, has 1 handler(s) for this service…

Service “orclXDB” has 1 instance(s).

Instance “orcl”, status READY, has 1 handler(s) for this service…

The command completed successfully

通过上述配置之后,看到了Listener Log File /u01/app/oracle/diag/tnslsnr/oel/listener/alert/log.xml

最后我们可以通过监听日志来查询里面的详细信息

[oracle@oel ~]$ grep ‘2012-07-01T13:45:40′ /u01/app/oracle/diag/tnslsnr/oel/listener/alert/log.xml|more

msg time=’2012-07-01T13:45:40.302+08:00′ org_id=’oracle’ comp_id=’tnslsnr’

如何启动oracle归档日志文件

一 设置为归档方式

Sql代码

sql archive log list; #查看是不是归档方式sql alter system set log_archive_start=true scope=spfile; #启用主动归档sql alter system set log_archive_dest=''location=/oracle/ora9/oradata/arch'' scope=spfile;#设置归档路径sql alter system set log_archive_dest_1=''location=/oracle/ora9/oradata/arch1'' scope=spfile;sql alter system set log_archive_dest_2=''location=/oracle/ora9/oradata/arch2'' scope=spfile;#如果归档到两个位置,则可以通过上边方法实现sql alter system set log_archive_format=''arch_%d_%t_%r_%s.log'' #设置归档日记款式sql shutdown immediate;

sql startup mount; #打开控制文件,不打开数据文件sql alter database archivelog; #将数据库切换为归档模式sql alter database open; #将数据文件打开sql archive log list; #查看此时是否处于归档模式查询以确定数据库位于archivelog模式中且归档过程正在运行sql select log_mode from v$database;

sql select archiver from v$instance;

Sql代码

日志切换

sql alter system switch logfile;

这次日志切换将归档写到两个目标地,

即上边的/oracle/ora9/oradata/arch1和/oracle/ora9/oradata/arch1,要是要对目录确认

在oracle情况中运行如下查询:

sql select name from v$archived_log;

而后在操作系统中确认查询所列出的文件

二 设置非归档方式

Sql代码

sql archive log list; #查看是否是归档方式sql alter system set log_archive_start=false scope=spfile;#禁用自动归档

sql shutdown immediate;

sql startup mount; #打开控制文件,不打开数据文件sql alter database noarchivelog; #将数据库切换为非归档模式sql alter database open; #将数据文件打开sql archive log list; #查看此时便处于非归档模式三 归档相关命令

Sql代码

archive log stop;

archive log start;

archive log list;

show parameters;

show parameters log_archive_start;

show parameters log_archive_max_process; #归档进程数alter system set log_archive_max_process=5; #将归档进程数改为5select * from v$bgprocess; #检察后台进程


新闻标题:怎么开启oracle日志,oracle 日志
本文网址:http://cdxtjz.cn/article/hojieg.html

其他资讯