How to collect the Database system information? (Form as the above)
Generally, when users across problem, they need to analyze the database system information before the problem occurs and when it occurs. So user needs to monitor the system information to know the system status and manage the system better, then help to solve problem.
To monitor system information continually, timer function is needed. You can write a timer program or use the timer that provided by operating system. Linux platform provides the “crontab” command, Windows platform provided the “at” command or to set task manager by graphical interface.
The following script we give is about Linux platform example using “crontab” command and dmsqlc tool to monitor system periodically. User can use “at” command and dmsql32 tool to set executing similar script in windows platform.
- crontab to set every 5 min and Mon-Friday to run checksys.bat$HOME/checksys.bat
crontab -e
*/5 * * * 1-5 $HOME/checksys.bat
2. checksys.bat (chmod +x checksys.bat)
cd $HOME
dmsqlc $HOME/script/ttt >> $HOME/checksys.out
3. ttt script
connect to dbsample4 sysadm;
select now();
set linewidth off;
select * from sysinfo;
select * from sysuser;
;You can add the SQL command to Monitor Lock
select now();
disconnect;
q;