监控数据库运行 下面是整理.收集监控数据库运行的一些常用脚本,也是MS SQL 日常维护管理常用脚本(一)的续集,欢迎大家补充.提意见. 查看数据库登录名信息 Code Snippet SELECT name AS LoginName , dbname AS DefaultDB , createdate AS CreateD…
查看数据库登录名信息 use mastergoSELECT name AS LoginName , dbname AS DefaultDB , createdate AS CreateDate, updatedate AS UpdateDate, language AS Language , THEN 'NT USER' ELSE 'SQL USER' END AS UserType FROM syslogins; 查看数据库用户信息 SELECT * FROM sysusers; 查看用户…
--[查看数据库服务器名称] --默认实例查询 SELECT @@SERVERNAME AS SERVERNAME; SELECT SERVERPROPERTY('servername') AS ServerName; SELECT srvname AS ServerName FROM sys.sysservers; SELECT SERVERPROPERTY('MachineName') AS ServerName --命名实例查询 SELECT SUBSTRING(@@SERVERNAME,…
select DEST_ID, APPLIED_SCN FROM v$archive_dest select * from v$dataguard_status; SELECT gvi.thread#, timestamp, message FROM gv$dataguard_status gvds, gv$instance gvi WHERE gvds.inst_id = gvi.inst_id AND severity in ('Error','Fatal') ORDER BY timest…