一、数据库的启动和关闭

启动数据库

启动方式含义
startup启动实例 加载数据库 打开数据库
startup nomount启动实例 不加载数据库
startup mount启动实例 加载数据库 不打开数据库

startup restrict

在启动过程中限制访问数据库

startup force

强制数据库启动

startup pfile=

使用非缺省参数文件启动数据库

命令详解

startup 

启动实例,加载数据库,打开数据库

startup open ccdb

startup nomount

此过程只启动了数据库实例,在此状态下我们可以访问下列结构文件

select * from v$instance;

select * from v$sga;

startup mount

可访问数据文件

select* from v$database;

select * from v$tablespace;

select * from v$log;

startup restrict 

启动过程中限制访问数据库

关闭数据库

shutdown normal 等待用户完成工作然后关闭

shutdown transactional 等待用户完成工作但是强制关闭连接

shutdown immediate 立即关闭 当前所有动作回滚到一直状态

shutdown abort 强制关闭,非干净关闭,下次重启后要回滚日志

 二、用户管理

1 检查用户profile

select username,profile from dba_users where username='scott'; 

2 查看用户的profile参数

select * from dba_profiles where profile='DEFAULT';

三、检查数据库基本状况

1 检查数据库创建日期

select created,log_mode from v$database;

2 检查数据库版本信息

select version from product_component_version;

3 检查实例状态

select inst_id,instance_name,host_name,version,to_char(startup_time,'yyyy-mm-dd hh24:mi:ss') startuptime,status ,datatbase_status from gv$instance;

select name,open_mode,log_mode from v$database;

4 查看数据库连接session

select count(*) from v$session;

5 查看并发连接数

select count(*) from v$session where status='ACTIVE';

6 监控系统后台进程

select name,description from v$bgprocess  where paddr<>'00';

更多推荐