达梦开启慢查询
1.修改参数文件
[dmdba@localhost gproj]$ more sqllog.ini
BUF_TOTAL_SIZE = 10240 #SQLs Log Buffer Total Size(K)(1024~1024000)
BUF_SIZE = 1024 #SQLs Log Buffer Size(K)(50~409600)
BUF_KEEP_CNT = 6 #SQLs Log buffer keeped count(1~100)
[SLOG_ALL]
FILE_PATH = /dmdbms/log
PART_STOR = 0
SWITCH_MODE = 2
SWITCH_LIMIT = 128
ASYNC_FLUSH = 1
FILE_NUM = 5
ITEMS = 0
SQL_TRACE_MASK = 1 ##1代表记录所有的执行语句
MIN_EXEC_TIME = 1000 ##单位毫秒
USER_MODE = 0
USERS =
EXECTIME_PREC_FLAG = 0
[SLOG_ERROR]
SQL_TRACE_MASK = 23
FILE_PATH = /dmdbms/log
[SLOG_DDL]
SQL_TRACE_MASK = 3
[SLOG_LONG_SQL]
SQL_TRACE_MASK = 25
MIN_EXEC_TIME = 60000
2.开启慢日志
[dmdba@localhost gproj]$ disql SYSDBA/dameng123
SQL> SP_SET_PARA_VALUE(1,'SVR_LOG',1);
如果对 sqllog.ini 进行了修改,可通过调用以下函数即时生效,无需重启数据库
SQL> SP_REFRESH_SVR_LOG_CONFIG();
开启后慢日志会保持在/dmdbms/log目录