以前教程中都说切换日志的话,需要先down掉服务,在cp日志文件到其他地方,但是在12.5之后多了个存储过程sp_errorlog,可以实现动态切换日志,
用法如下
sp_errorlog 'change log','/opt/sybase/ASE-15_0/install/www3.log', 'jslog false'
详细介绍如下
sp_errorlog
Description Dynamically changes the path of the error log.
Syntax sp_errorlog “change log“, “new_path“ [,{“jslog true“ | “jslog false“}]
sp_errorlog “help”, “change log”
Parameters new_path
new path of the error log. Maximum length of new_path is 255 characters.
jslog true
the default option. If the Job Scheduler is running, change log attempts to
change the Job Scheduler Agent log to the directory where the new Adaptive
Server error log will reside. Both logs will indicate error messages, if any.
jslog false
do not change the location of the Job Scheduler Agent log.
Examples Example 1 To change the Adaptive Server error log to use a new location
without changing the location of the Job Scheduler log, use:
sp_errorlog 'change log',
'$SYBASE/$SYBASE_ASE/install/new.log', 'jslog false'
Adaptive Server error log location is changed to
$SYBASE/$SYBASE_ASE/install/new.log. However, the location of the Job
Scheduler Agent log is not changed.
Example 2 This example changes the error log location to
$SYBASE/$SYBASE_ASE/install/new.log.
If the Job Scheduler Agent is running, the agent log location is also changed to
$SYBASE/$SYBASE_ASE/install/new.log.
If the Job Scheduler Agent is not running, Adaptive Server does not change the
agent log location.You see a message that the agent log location is unchanged.
sp_errorlog 'change log',
'$SYBASE/$SYBASE_ASE/install/new.log', 'jslog true'
Example 3 This example changes the Adaptive Server error log to
$SYBASE/$SYBASE_ASE/install/new.log.
If the Job Scheduler Agent is running, the agent log is also changed to
$SYBASE/$SYBASE_ASE/install/new.log.
If the Job Scheduler Agent is not running, Adaptive Server does not change the
path of the Job Scheduler Agent log. You do not see a message that the agent
log location is unchanged.
sp_errorlog 'change log','$SYBASE/$SYBASE_ASE/install/new.log'