Oracle笔记: Statspack安装使用
俗话说,工欲善其事,必先利其器。做数据库性能分析,也要有一款好的工具。statspack就是oracle自带的一个强大并且免费的性能分析工具。
安装statspack需要用户具有sysdba的权限。首先以sysdba登陆,为statspack创建一个单独的tablespace。
Sql代码
1.SQL> create tablespace perfstat datafile 'D:\oracle\oradata\epcit\data_file\PERFSTAT.DBF' size 2G;
2.
3.Tablespace created.
SQL> create tablespace perfstat datafile 'D:\oracle\oradata\epcit\data_file\PERFSTAT.DBF' size 2G;
Tablespace created.
然后运行spcreate.sql。安装 statspack所需要的sql文件都位于%oracle_home%\RDBMS\ADMIN目录下。为了使用方便,可以把这个路径加入到环境变量 sqlpath中(set sqlpath=%oracle_home\RDBMS\ADMIN)。
Sql代码
1.SQL> @spcreate
2.
3.Choose the PERFSTAT user's password
4.-----------------------------------
5.Not specifying a password will result in the installation FAILING
6.
7.Enter value for perfstat_password: password
8.
9.Enter value for default_tablespace: perfstat
10.Using tablespace PERFSTAT as PERFSTAT default tablespace.
11.
12.Enter value for temporary_tablespace: temp
13.Using tablespace temp as PERFSTAT temporary tablespace.
14.
15… Creating PERFSTAT user
16… Installing required packages
17… Creating views
18… Granting privileges
19.
20.NOTE:
21.SPCUSR complete. Please check spcusr.lis for any errors.
22.
23.SQL> -- Build the tables and synonyms
24.SQL> connect perfstat/&&perfstat_password
25.Connected.
26.SQL> @@spctab
27.
28.Using perfstat tablespace to store Statspack objects
29.
30… Creating STATS$SNAPSHOT_ID Sequence
31… Creating STATS$… tables
32.
33.NOTE:
34.SPCTAB complete. Please check spctab.lis for any errors.
35.
36.SQL> -- Create the statistics Package
37.SQL> @@spcpkg
38.
39.Creating Package STATSPACK…
40.Package created.
41.
42.Creating Package Body STATSPACK…
43.Package body created.
44.
45.NOTE:
46.SPCPKG complete. Please check spcpkg.lis for any errors.
SQL> @spcreate
Choose the PERFSTAT user's password
-----------------------------------
Not specifying a password will result in the installation FAILING
Enter value for perfstat_password: password
Enter value for default_tablespace: perfstat
Using tablespace PERFSTAT as PERFSTAT default tablespace.
Enter value for temporary_tablespace: temp
Using tablespace temp as PERFSTAT temporary tablespace.
&hell
相关新闻>>
- 发表评论
-
- 最新评论 更多>>