SQL code --备份declare @sql varchar(8000) set @sql='backup database mis to disk=''d:\databack\mis\mis'+rtrim(convert(varchar,getdate(),112))+'.bak''' exec(@sql) --删除15天前备份文件 set @sql='del d:\databack\mis\mis' +rtrim(convert(varchar,getdate()-15,112))+'…
1查看数据库版本SELECT * FROM V$VERSION; 2查看数据库语言环境SELECT USERENV('LANGUAGE') FROM DUAL; 3查看ORACLE实例状态SELECT INSTANCE_NAME,HOST_NAME,STARTUP_TIME,STATUS,DATABASE_STATUS FROM V$INSTANCE; 4查看ORACLE监听状态lsnrctl status 5查看数据库归档模式SELECT NAME,LOG_MODE,OPEN_MODE FRO…
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…
监控数据库运行 下面是整理.收集监控数据库运行的一些常用脚本,也是MS SQL 日常维护管理常用脚本(一)的续集,欢迎大家补充.提意见. 查看数据库登录名信息 Code Snippet SELECT name AS LoginName , dbname AS DefaultDB , createdate AS CreateD…