RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
oracle如何输出报告,oracle输出格式

如何生成Oracle AWR报告

oracle手工生成AWR报告方法记录

创新互联主营两当网站建设的网络公司,主营网站建设方案,app软件开发,两当h5重庆小程序开发搭建,两当网站营销推广欢迎两当等地区企业咨询

AWR(Automatic Workload Repository)报告是DBA进行日常数据库性能评定、问题SQL发现的重要手段。熟练掌握AWR报告,是做好开发、运维DBA工作的重要基本功。

1、 运行脚本

首先,准备一个目录作为AWR生成报告的路径。

[oracle@bspdev /]$ ls -l | grep test

drwxr-xr-x. 2 oracle oinstall 4096 Jun 21 13:01 test

[oracle@bspdev /]$ cd test

启动sqlplus等开发工具,调用生成脚本。程序脚本一般保存在$ORACLE_HOME下的rdbms/admin中,名称为awrrpt.sql。

[oracle@bspdev test]$ sqlplus /nolog

SQL*Plus: Release11.2.0.1.0 Production on Tue Jun 21 13:04:44 2011

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL conn / as sysdba

Connected.

--调用脚本,生成文件

SQL @?/rdbms/admin/awrrpt.sql

之后进入报告参数输入模块。

2、输入报告参数

之后,要持续输入一系列的报告参数。

ü 输入生成报告类型,目前AWR提供txt和html两种格式。需要确认生成格式,默认是html格式。

Current Instance

~~~~~~~~~~~~~~~~

DB Id DB Name Inst Num Instance

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

4143510747 ORA11G 1 ora11g

Specify the Report Type

~~~~~~~~~~~~~~~~~~~~~~~

Would you like an HTML report, or a plain text report?

Enter 'html' for an HTML report, or 'text' for plain text

Defaults to 'html'

ü 报告涉及天数范围

启动报告后,会显示生成实例的名称等基本信息。

默认情况下,AWR会将镜像信息保留一个月。手工生成的时候,需要确认生成AWR报告的时间范围。一般情况下,特别是生产环境下,我们通常设置1-7天也就够用了。

Instances in this Workload Repository schema

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DB Id Inst Num DB Name Instance Host

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

* 4143510747 1 ORA11G ora11g bspdev.local

domain

Using 4143510747 for database Id

Using 1 for instance number

Specify the number of days of snapshots to choose from

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Entering the number of days (n) will result in the most recent

(n) days of snapshots being listed. Pressing without

specifying a number lists all completed snapshots.

Enter value for num_days:3

ü 输入开始和结束的snapshot编号

输入天数信息后,AWR生成代码会将天数范围内的snapshot镜像点列出,供输入选择。

Listing the last 3 days of Completed Snapshots

Snap

Instance DB Name Snap Id Snap Started Level

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

ora11g ORA11G 1789 20 Jun 2011 13:01 1

1790 20 Jun 2011 14:00 1

1791 20 Jun 2011 15:00 1

1792 20 Jun 2011 16:00 1

(篇幅原因,有省略……)

1811 21 Jun 2011 11:00 1

1812 21 Jun 2011 12:00 1

1813 21 Jun 2011 13:00 1

Specify the Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

之后,我们需要根据列出的时间范围,输入开始和结束的snap编号。

Specify the Begin and End Snapshot Ids

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Enter value for begin_snap:1796

Begin Snapshot Id specified: 1796

Enter value for end_snap:1813

ü 确定报告名称

最后就是确定生成报告的名称。一般采用默认的名称就可以了。

Specify the Report Name

~~~~~~~~~~~~~~~~~~~~~~~

The default report file name is awrrpt_1_1796_1813.html. To use this name,

press to continue, otherwise enter an alternative.

Enter value for report_name:

之后输出内容很多,此处不加以累述。最后提示报告生成成功。

Report written to awrrpt_1_1796_1813.html

于是,指定目录上可以看到相应的报告文件。

[oracle@bspdev test]$ ls -l

total 508

-rw-r--r--. 1 oracle oinstall 515262 Jun 21 13:10 awrrpt_1_1796_1813.html

oracle 如何把数据库查询结果导出

1、打开oracle数据库,点击登陆选项,点击文件选项,点击新建选项,最后点击sql窗口;

2、然后在sql窗口中进行编写sql语句的操作,勇sql语句进行查询出想要导出来的数值;

3、然后在查询出来数据的地方,不要选中数据,把鼠标放到空白单元格处进行鼠标右键操作,找到复制到Excel选项;

4、然后在复制到excel中选择想要保存的格式--作为xls保存,打开后则是excel形式的数据;

5、默认的保存路径--将鼠标放在excel名称上--会出现路径--根据路径打开即可。

oracle存储过程如何输出信息

可用DBMS_OUTPUT.PUT_LINE()对存储过程的进行输出。

编写存储过程:

create or replace procedure test_pro(in_num number)

as

M number;

begin

M := in_num;

if 0 M then

dbms_output.put_line('输出SQL语句1');

elsif M 3 then

dbms_output.put_line('输出SQL语句2');

else

dbms_output.put_line('nothing');

end if;

end;

扩展资料;

存储在数据库的数据字典中,存储在当前的应用中安全性由数据库提供安全保证,必须通过授权才能使用存储子程序,安全性靠应用程序来保证,如果能执行应用程序,就能执行该子程序。模式描述IN参数用来从调用环境中向存储过程传递值,不能给IN参数赋值,给此参数传递的值可以是常量、有值的变量、表达式等。

参考资料来源:百度百科-Oracle存储过程

oracle如何使用arw在同一文件中生成两份报告 怎么操作

1、执行awrddrpt命令,选择默认报表格式

2、填写生成报告时间,这里填写一天

3、第一次选择id时 开始id选择950 结束id选择 953

4、这里会再次选择报告时间,也填写1天

5、再次选择id开始id选择954 结束id选择957

6、报告文件名称使用默认即可。

7、打开报告文件可以看到里面会有两个点的报告信息,并列出了两个报告点之间的不同点。


网站名称:oracle如何输出报告,oracle输出格式
URL标题:http://cqwzjz.cn/article/hcdjeh.html