SQL>shutdown immediate; oracle停止
SQL>startup; oracle启动
lsnrctl start 监听启动
lsnrct stop 监听停止
lsnrctl status 监听状态
SQL>select status from v$instance;
SQL>select open_mode from v$database;
SQL>select * from v$version;
SQL>show parameter processes;
SQL> show parameter sga;
SQL> select name,value from v$parameter where name=‘processes‘;
SQL> alter system set processes=1500 scope=spfile; #重启ORACLE使修改参数生效
SQL>select bytes/1024/1024/1024 as "Size(G)",name from v$datafile order by bytes;
SQL> select bytes/1024/1024/1024 as "Size(G)",name from v$tempfile order by bytes;
SQL> create user username identified by password default tablespace tablespace; #创建oracle用户,
SQL> drop user username cascade; #删除oracle用户
SQL> alter user username account unlock; #解锁oracle用户
SQL>alter user username identified by new_password; #修改oracle用户密码
SQL>set autotrace on; #打开跟踪SQL执行计划
SQL>select username from dba_users; #跟踪的SQL
SQL>set autotrace off;
SQL> set timing on; #打开执行时间统计
SQL>show parameter background_dump_dest;
SQL>select name,value from v$parameter v where v.name like ‘%background%‘;
SQL>create tablespace tablespacename datafile ‘/home/oracle/tablespace.dbf‘ size 1024M; #创建数据表空间
SQL>create temp tablespae temp tempfile ‘/home/oracle/temp.dbf‘ size 1024M; #创建临时表空间
SQL> create undo tablespace undotbs datafile ‘/home/oracle/undotbs.dbf‘ size 1024M; #创建回滚表空间
SQL>alter tablespace tablespacename add datafile ‘/home/oracle/add_tablespacename.dbf‘ size 1024M; #增加数据文件方式,不允许自动增长
SQL> alter tablespace tablespacename add datafile ‘/home/oracle/add_tablespacename.dbf‘ size 1024M autoextend on next 5M maxsize 2048M; #增加数据文件方式且允许自动增长
SQL> alter database datafile ‘/home/oracle/tablespace.dbf‘ autoextend on next 5M maxsize 2048M; #允许已存在的数据文件自动扩展
SQL> alter database datafile ‘/home/oracle/tablespace.dbf‘ resize 2048M; # 改变当前数据文件大小
#调整临时表空间文件
SQL> alter tablespace temp add tempfile ‘/home/oracle/temp2.dbf‘ size 2048M; #扩展临时表空间大小,默认autoextend off
SQL> alter tablespace temp add tempfile ‘/home/oracle/temp2.dbf‘ size 1024M antoextend on next 128M maxsize 2048M; #扩展临时表空间大小
SQL> alter database tempfile ‘/home/oracle/temp.dbf‘ resize 2048M;
SQL> select sum(d.bytes)/1024/1024/1024 ||‘G‘ as total_bytes,d.tablespace_name from dba_datafiles d where d.tablespace_name = ‘UNDOTBS‘ group by d.tablespace_name;
SQL> set line 120
SQL>col username for a30;
SQL>select sid,serial#,username,type from v$session;
or
SQL>select sid,serial# from v$session where username=‘USERNAME‘;
SQL> drop tablespace tablespacename including contents and datafiles;
SQL>select property_name,property_value from database_properties where property_name=‘DEFAULT_TEMP_TABLESPACE‘;
SQL>alter database default temporary tablespace temp2;#修改oracle实例默认临时表空间,不能直接删除,需先创建新的临时表空间、修改后再删除
原文:http://www.cnblogs.com/linyfeng/p/7225094.html