The AUTOMAINT_GET_POLICYFILE system stored procedure retrieves
the automatic maintenance configuration for the database.
This procedure takes two parameters: the type of automatic
maintenance about which to collect information; and the name of a
file in which to return the configuration information. The configuration
information is returned in XML format.
Authorization
One
of the following authorities is required to execute the routine:
- EXECUTE privilege on the routine
- DATAACCESS authority
- DBADM authority
- SQLADM authority
Default PUBLIC privilege
None
Syntax
>>-AUTOMAINT_GET_POLICYFILE--(--policy_type--,--policy_file_name--)-><
The schema is SYSPROC.
Procedure parameters
- policy_type
- An input argument of type VARCHAR(128) that specifies the type
of automatic maintenance policy to retrieve. The argument can be
one of the following values:
- AUTO_BACKUP
- automatic backup
- AUTO_REORG
- automatic table and index reorganization
- AUTO_RUNSTATS
- automatic table runstats operations
- MAINTENANCE_WINDOW
- maintenance window
- policy_file_name
- An input argument of type VARCHAR(2048) that specifies the name
of the file that is created in the tmp subdirectory
of the DB2® instance directory.
Note: The file name may be prefixed with a path relative to tmp.
In that case the directory should exist, should have permission to
create/overwrite the file and the correct path separator for the DB2 Server must be used.
- For example:
- On UNIX if the instance
directory is defined as $HOME/sqllib. For a policy
file named 'policy.xml', the file name will be '$HOME/sqllib/tmp/policy.xml'
- On Windows, the instance
directory name can be determined from the values of the DB2INSTPROF registry
variable and the DB2INSTANCE environment variable.
For a policy file named 'policy.xml', if db2set gives DB2INSTPROF=C:\DB2PROF and %DB2INSTANCE%=db2,
then the file name will be C:\DB2PROF\db2\tmp\policy.xml
Example
To get the current automatic
maintenance settings for backup operations:
call sysproc.automaint_get_policyfile( 'AUTO_BACKUP', 'AutoBackup.xml' )
This will create an XML file named AutoBackup.xml in
the tmp subdirectory under the DB2 instance directory.