2008年(137)
分类: Oracle
2008-05-18 17:00:15
internal/oracle
sys/change_on_install
system/manager
scott/tiger
sysman/oem_temp
dministrator/administrator
Oracle 8: dbassist;
Oracle9i and later: dbca
SQL> select * from v$version;
Oracle 8: SVRMGR: Server Manager
Oracle 9i and later: 已经改为用SQLPLUS了
SQL> select unique machine, terminal from v$session;
desc table_name(可以查询表的结构)
select field_name,... from ... (可以查询字段的值)
select * from all_tables where
table_name like '%'
select * from all_tab_columns where table_name='??'
select owner,table_name,num_rows,blocks*AAA/1024/1024 "Size M",empty_blocks,last_analyzed from dba_tables where table_name="XXX";
Here: AAA is the value of
db_block_size ;
XXX is the table name you want to check
SQL> col tablespace format a20
SQL> set linesize 120
SQL> select b.file_id FILE_ID,b.tablespace_name TABLE_NAME, b.bytes BYTES,(b.bytes-sum(nvl(a.bytes,0))) USED,sum(nvl(a.bytes,0)) LEFT_SPACE, sum(nvl(a.bytes,0))/(b.bytes)*100 "LEFT%" from dba_free_space a,dba_data_files b where a.file_id=b.file_id group by b.tablespace_name,b.file_id,b.bytes order by b.file_id ;
SQL> show parameter processes OR
SQL> select name, value from v$parameter where name like 'proc%';
Modify init.ora file
log_archive_start = true
RESTART DATABASE OR
SQL> Stutdown database
SQL> Startup mount
SQL> alter database archivelog/noarchivelog;
SQL> alter database open
SQL> select unique username from v$session;
SQL> select name from v$database;
SQL> select * from dba_sys_privs;
alter table TABLE_NAME move TABLESPACE_NAME;
alter index INDEX_NAME rebuild tablespace TABLESPACE_NAME;
select * from user_objects;
select * from dba_segments;
SQL> show sga
SQL> select * from nls_database_parameters;
SQL> select * from v$nls_parameters;
SQL> select * from dba_data_files;
9i and later: SQL> select systimestamp from dual;
SQL> select 'Welcome to access'||chr(10)||'SANer.cublog.cn' from dual ;
alter session set nls_date_format='yyyymmddhh24miss'; OR
add this line into init.ora file
nls_date_format='yyyymmddhh24miss'
alter table xxx storage(buffer_pool keep);
SQL> select rownum, sysdate from dual;
SQL> select tablespace_name from user_tables where table_name='TEST';
SQL> select TABLESPACE_NAME from dba_tablespaces;
SQL> create pfile from spfile; (create pfile)
create spfile='/oracle/spfile' from pfile='/oracle/10g/dbs/initorc1.ora'; (create SPFILE)
exp 用户/密码 tables=(表1,…,表2)
exp用户/密码owner=(用户1,用户2,…,用户n) file=导出文件
SQL> show user
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;
SQL> truncate table table_name;
SQL> SELECT * FROM V$INSTANCE;
SQL> spool '/tmp/abc.test'
SQL> select sysdate from dual;
SQL> spool off
SQL> SET AUTOTRACE ON
SQL> select * from all_tables;
SQL> SELECT * FROM v$filestat
alter table table_name modify (field_name varchar2(100));
SQL> alter table old_table_name rename to new_table_name;
SQL> archive log list