这篇文章主要介绍甲骨文AWR公司如何实现数据导入/导出,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
Linux操作系统操作系统状态下,连接神谕用户:su - oracle
1.上传采集快照dmp .文件至服务器(dbid:4292035712) 919219826
2.在服务器端创建目录(即文件夹awrtest)
$mkdir/home/oracle/awrtest3 .把第一步中上传的dmp .文件,移动到第二步中创建的文件夹中:
$cp/var/ftp/AWR_10107.dmp(如果原文件后缀名是DMP一定要改成小写dmp)/home/oracle/awrtest4 .切换至sqlplus状态,并且启动数据库:
$sqlplus/assysdba
SQLstartup5。创建数据库目录便于数据库查找
sqlcreatedoriyawrtestas '/home/Oracle/awr test ';6.加载数据文件:
SQL@?/rdbms/admin/awrload.sql
SQLEntervaluefordirectory _ name : a ortest////注意:输入directoryname时,字母需要大写
输入文件名的值:AWR_10107//注意:此处不要加文件后缀名
输入valueforschema _ name : AWr _ STAGE/(一般默认就行)
输入默认值表空间:用户
输入temporary _ tablespace :/(回车默认)出现一下文字,就说明导入成功了!
.createngawr _ STAGEuser | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | loading heawrdata来自以下|目录/文件3360 |/home/Oracle/awr | AWRDAT _ 9239 _ 9394。DMP | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~.| |此操作将采取安全措施| progressofwrlloadoperationcane | monitored followinding directory/file : |/home/Oracle/awr | AWRDAT _ 9239 _ 9394。日志|.dropping ing ing ur _ stageuserendofawload-http://www . Sina.com/(注意文件夹复权的问题!)
[root @ localhost ~]# CD/home/Oracle/[root @ localhost Oracle]# ls-lt
总计660 drwxr-xr-x2 rootrout 4096 aug6nb
sp;02:07 awr
drwxr-xr-x 2 root root 4096 Aug 6 02:04 awrtest2 -rw-r--r-- 1 oracle oinstall 326088 Jul 8 22:13 zhongxing.html -rw-r--r-- 1 oracle oinstall 311525 Jul 1 12:48 HUAYOUSHIJI.html drwxr-xr-x 3 oracle oinstall 4096 Jul 1 11:32 awrtest1
drwxr-xr-x 2 oracle oinstall 4096 Jul 1 01:10 awrtest
drwxr-xr-x 2 oracle oinstall 4096 Jun 30 12:47 jishubu
drwxr-xr-x 3 oracle oinstall 4096 Jun 22 14:58 Desktop [root@localhost oracle]# chmod -R 777 awr [root@localhost oracle]# ls -lt
total 660 drwxrwxrwx 2 root root 4096 Aug 6 02:07 awr
drwxr-xr-x 2 root root 4096 Aug 6 02:04 awrtest2 -rw-r--r-- 1 oracle oinstall 326088 Jul 8 22:13 zhongxing.html -rw-r--r-- 1 oracle oinstall 311525 Jul 1 12:48 HUAYOUSHIJI.html drwxr-xr-x 3 oracle oinstall 4096 Jul 1 11:32 awrtest1
drwxr-xr-x 2 oracle oinstall 4096 Jul 1 01:10 awrtest
drwxr-xr-x 2 oracle oinstall 4096 Jun 30 12:47 jishubu
drwxr-xr-x 3 oracle oinstall 4096 Jun 22 14:58 Desktop [root@localhost oracle]#
其他报错问题 解决参考地址:
http://space.itpub.net/12129601/viewspace-735524 http://www.xifenfei.com/3966.html 惜分飞 http://blog.163.com/jet_it_life/blog/static/205097083201262431444951/directory 创建不正确导致的ORA-39070 http://www.douban.com/note/37656300/oracle impdp/expdp 的权限问题 http://space.itpub.net/519536/viewspace-664406 侯圣文老师
AWR数据迁移参考地址:
春风: http://www.dbdream.org/?p=223
eygle: AWR 与 Statspack 数据的导出与迁移 http://www.eygle.com/archives/2010/08/awr_statspack_extract.html
7.执行相关脚本:(如逻辑读脚本、db-time脚本等)
查看dbid:
SQL> select dbid from v$database; 223805804 SQL> setpagesize 500 # su - oracle $ cd awrtest/ #根据自己的安装目录确认 $ ls (查看当前目录下文件,确认相关文件名)
生成逻辑读-语句:
SELECT case when to_number(to_char(c.end_interval_time, 'mi'))<15 or to_number(to_char(c.end_interval_time, 'mi'))>=45
then to_char(round(c.end_interval_time, 'hh34'),'yyyy-mm-dd hh34:mi')
else to_char(c.end_interval_time, 'yyyy-mm-dd hh34')||':30'
end end_time,
case when max(decode(a.instance_number, 1, a.value - b.value, null))<0 then null
else max(decode(a.instance_number, 1, a.value - b.value, null))
end INST1,
case when max(decode(a.instance_number, 2, a.value - b.value, null))<0 then null
else max(decode(a.instance_number, 2, a.value - b.value, null))
end INST2,
case when max(decode(a.instance_number, 3, a.value - b.value, null))<0 then null
else max(decode(a.instance_number, 3, a.value - b.value, null))
end INST3,
case when max(decode(a.instance_number, 4, a.value - b.value, null))<0 then null
else max(decode(a.instance_number, 4, a.value - b.value, null))
end INST4
FROM sys.wrh$_sysstat a, sys.wrh$_sysstat b, sys.wrm$_snapshot c
WHERE a.stat_id =3143187968
AND b.stat_id = a.stat_id
AND a.snap_id = b.snap_id + 1
AND a.snap_id = c.snap_id
and a.dbid =&dbid
and b.dbid = a.dbid
and c.dbid = a.dbid
and a.instance_number = b.instance_number
and a.instance_number = c.instance_number
group by a.snap_id, case when to_number(to_char(c.end_interval_time, 'mi'))<15 or to_number(to_char(c.end_interval_time, 'mi'))>=45
then to_char(round(c.end_interval_time, 'hh34'),'yyyy-mm-dd hh34:mi')
else to_char(c.end_interval_time, 'yyyy-mm-dd hh34')||':30'
end
ORDER BY a.snap_id;
注意:结尾的分号不能少。
生成db-time数据语句:
SELECT TO_CHAR(b.end_interval_time, 'yyyy-mm-dd hh34:mi:ss') snap_time,
--'DB Time(s)',
CASE
WHEN (ROUND((a.VALUE - lag(a.VALUE, 1) OVER(ORDER BY a.snap_id)) / 1000000))<0
THEN 0
ELSE ROUND((a.VALUE - lag(a.VALUE, 1) OVER(ORDER BY a.snap_id)) / 1000000)
END AS "db time(s)"
FROM
(SELECT snap_id,
VALUE
FROM dba_hist_sys_time_model
WHERE stat_name = 'DB time'
and dbid=&db_id
AND INSTANCE_NUMBER = &instance_id) a,
dba_hist_snapshot b
WHERE b.dbid=&db_id
AND a.snap_id = b.snap_id
AND b.INSTANCE_NUMBER = &instance_id
--AND b.end_interval_time > sysdate-30
ORDER BY 1;
Enter value for db_id: 4292035712
Enter value for instance_id: 1 ///(单实例输入1,RAC 的根据实际情况输入相应的值)
Enter value for db_id: 4292035712
Enter value for instance_id: 1
8.导入excel表 ,生成趋势图
excel里边选择数据 -导入-自文本
选择导入的数据-生成曲线图-双击横坐标选择文本格式
9. 观察趋势图高峰值,导出AWR报告,Oracle用户下执行如下命令:
@?/rdbms/admin/awrrpti
导出的AWR报告有两种类型格式: .txt 和 .html
系统默认导出是.html 一般输入时间间隔天数:7
按照步骤,连续操作就行。
Enter value for dbid: 4292035712 Using 4292035712 for database Id Enter value for inst_num: 1(输入实例个数) Using 1 for instance number
例如:导出时间点为:7月1日 11点 12点 负载高峰时段的AWR数据。
注意:在导出报告时,文件起名时要手动添加后缀名.html
以上是“Oracle AWR如何实现数据导入/导出”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/83256.html