Page 526
All scripts are invoked from the main script spc_mgr.u. The user can write additional utilities using the repository information and can then have them called from spc_mgr.u.
Understanding Space Manager Repository DetailsSpace Manager builds objects in the schema where the repository resides. It is recommended that you create a user called spcmgr for using Space Manager, because then it operates in isolation as Space Controlling Center. Refer to Appendix A, "Oracle on UNIX," for attached listing details.
The list shown next shows the various objects that the Space Manager repository is comprised of. Basically the repository is made of one package spc_pkg and a few other repository tables.
Page 527
The package spc_pkg and all other repository tables are created by using the Build Repository option from Space Manager. The repository can be dropped with equivalent from Space Manager using the Drop Repository option.
Installing Space ManagerDecide upon a home directory where Space Manager is to be installed and then copy all the Space Manager scripts from the CD to the directory. It is recommended that you use a directory like /unn/spc_mgr as the home directory of the product.
Decide upon the database user in whose schema the product will be installed. It's best to use a dedicated schema and name it spcmgr.
You must now modify the product setup file, spc_set.var, to reflect these changes. For example, if the database user under which Space Manager is installed is spcmgr, and the password xx and home directory under which Space Manager is installed is /u01/spc_mgr, then the setup file spc_set.var looks something like this:
dbuser=spcmgr dbpasswd=xx scriptdir=/u01/spc_mgr editor=vi export dbuser dbpasswd scriptdir editor
Before building the repository, some system privileges are to be granted to Space Manager. The following are the detailed privileges to be granted to Space Manager.
All these steps can be done by logging into SQL*PLUS as SYSTEM and running spc_grn.sql, which all grant all the privileges to the Space Manager User spcmgr.
You can also manually execute the following commands and achieve the same:
SQL>grant resource to spcmgr; SQL>grant analyze any to spcmgr; SQL>grant role dba to spcmgr; SQL>grant select on v_$parameter to spcmgr; SQL>grant select on dba_extents to spcmgr; SQL>grant select on dba_segments to spcmgr; SQL>grant select on dba_free_space to spcmgr;
Page 528
Building the Space Manager RepositoryTo build the repository run from the home directory of Space Manager, run the command ./spc_mgr.u from command prompt. This should bring the Space Manager main menu as shown in Figure 21.18.
Select Option 1 from the menu, which should automatically build the repository for you using the spc_set.var as the reference file. It prompts you for the tablespace under which the repository is to be built. Use TOOLS if one already exists on your system. Ignore any drop errors that occur, as Space Manager will try to drop any existing repository tables.
NOTE |
Check for any other errors while building the repository and correct them.n |
Using Space ManagerMost of the options in Space Manager prompt you to enter the Start Space ID and the End Space ID after displaying the Space ID's captured as yet. The prompt will look as follows:
Completed Snapshots Instance Startup Time Snap Started SPC_ID -------- -------------------- -------------------- -------- 0 26 Jul at 10:52:52 26 Jul at 20:39:22 1 28 Jul at 07:54:47 28 Jul at 11:10:05 3 28 Jul at 18:40:21 5 28 Jul at 18:41:32 6 28 Jul at 18:58:16 7 28 Jul at 21:36:51 28 Jul at 21:46:26 8 28 Jul at 22:00:13 9 Enter SPC ID of start snap: 1 Enter SPC ID of end snap: 8 Enter name of output file [OBJ_GR1_8] :
This previous output shows all snapshots captured to date. The user is prompted to enter the Start SPC ID and the End SPC ID. Using the statistics captured between the intervals entered, the required outputs are shown.