oracle 笔记:
unix 命令:ipcs
sql语句: show sga
--查看granule_size
select component,granule_size from v$sga_dynamic_components
alter system set shared_pool_size = 64m;
select name,value from v$parameter;
show parameter pag
--根据pfile创建spfile
create spfile from pfile;
create spfile='$ORACLE_HOME/dbs/spfileTS.ora' from pfile=''$ORACLE_HOME/dbs/initTS.ora'
--根据spfile创建pfile
create pfile from spfile;
--修改spfile参数
alter system set parameter=value <comment='text'> <deferred> <scope=memory|spfile|both> <sid='sid|*'>
如:alter system set fast_start_mttr_target =300;
alter system set fast_start_mttr_target =300 comment='hello TS';
select name,value,update_comment from v$parameter where name ='fast_start_mttr_target';
--延迟加载的参数
select name,issys_modifiable from v$parameter where issys_modifiable='DEFERRED';
-- deleting or resetting values
alter system set undo_suppress_errors=true;
alter system reset undo_suppress_errors scope=spfile sid='*';;
Backgroup Process
1、Mandatory background Process
DBWn PMON CKPT LGWR SMON
2、Optional background Process
ARCn LMDn QMNn CJQ0 LMON RECO
Dnnn LMS Snnn LCKn Pnnn
Non-interactive Installation
./runInstaller -responsefile myrespfile -silent
myrespfile 示例:/home/oracle/database/response/enterprise.rsp
三、 Managing an Oracle Instance
2、ORACLE启动状态:shutdown ----------->nomount -------------->mount ---------------->open
查看数据库处于什么状态:select open_mode from v$database;
startup nomount (Instance started)
alter database mount;(Control file opened for this instance)
alter database open;(All files opened as described by the control file for this instance)
3、 restrict状态
alter system enable restricted session;
select saddr,sid,serial# from v$session;
select sid,serial#,username from v$session;
alter system kill session '16,5';
4、 read-only状态
startup mount;
alter database open read only;
5、更改session的sql_trace
alter session set sql_trace=true;
6、查看user状态并打开
select username ,account_status from dba_users;
alter user scott account unlock;
alter user hr identified by hr; --修改密码
四、 Creating a Database
1、创建oracle认证用户密码
orapwd file=orapwTS password=sunlin entries=10
2、
3、
(1) lin.env
ORACLE_BASE=/home/oracle
ORACLE_HOME=$ORACLE_BASE/db
ORACLE_SID=lin
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH(2)initlin.ora
lin.__db_cache_size=197132288
lin.__java_pool_size=4194304
lin.__large_pool_size=4194304
lin.__shared_pool_size=75497472
lin.__streams_pool_size=0
audit_file_dest='/home/oracle/admin/lin/adump'
background_dump_dest='/home/oracle/admin/lin/bdump'
compatible='10.2.0.1.0'
control_files='/home/oracle/oradata/lin/control01.ctl','/home/oracle/oradata/lin/control02.ctl','/home/oracle/oradata/lin
/control03.ctl'
core_dump_dest='/home/oracle/admin/lin/cdump'
db_block_size=8192
db_domain=''
db_file_multiblock_read_count=16
db_name='lin'
db_recovery_file_dest='/home/oracle/flash_recovery_area'
db_recovery_file_dest_size=2147483648
dispatchers='(PROTOCOL=TCP) (SERVICE=linXDB)'
job_queue_processes=10
nls_language='AMERICAN'
open_cursors=300
pga_aggregate_target=94371840
processes=150
remote_login_passwordfile='EXCLUSIVE'
sga_target=285212672
undo_management='AUTO'
undo_tablespace='UNDOTBS1'
user_dump_dest='/home/oracle/admin/lin/udump'
(3) 创建目录
(4)crdb01.sql ------创建数据库语句
pool dbcreate.log
CREATE DATABASE "lin"
MAXDATAFILES 500
MAXINSTANCES 8
MAXLOGFILES 32
CHARACTER SET "UTF8"
NATIONAL CHARACTER SET AL16UTF16
ARCHIVELOG
DATAFILE
'/home/oracle/oradata/lin/system01.dbf' size 300m
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/home/oracle/oradata/lin/tempts01.dbf' SIZE 100M EXTENT MANAGEMENT LO
CAL
UNDO TABLESPACE "UNDOTBS1"
DATAFILE '/home/oracle/oradata/lin/undotbs01.dbf' SIZE 200M
SYSAUX DATAFILE '/home/oracle/oradata/lin/sysaux01.dbf' SIZE 300M
LOGFILE
GROUP 1 (
'/home/oracle/oradata/lin/redo01a.rdo',
'/home/oracle/oradata/lin/redo01b.rdo'
) SIZE 100M,
GROUP 2 (
'/home/oracle/oradata/lin/redo02a.rdo',
'/home/oracle/oradata/lin/redo02b.rdo'
) SIZE 100M,
GROUP 3 (
'/home/oracle/oradata/lin/redo03a.rdo',
'/home/oracle/oradata/lin/redo03b.rdo'
) SIZE 100M
;
(5)生成orapw文件
orapw file=orapwlin password=sunlin entries=10
(6)执行生成数据库语句
sql>@$ORACLE_HOME/dbs/crdb01.sql
sql>@?/rdbms/admin/catalog.sql
sql>@?/rdbms/admin/catproc.sql
sql>@?/rdbms/admin/catclust.sql
一、
1、ORACLE启动
startup pfile=$ORACLE_HOME/dbs/abc123.ora
2、ORACLE启动状态:shutdown ----------->nomount -------------->mount ---------------->open
一、
1、ORACLE启动
startup pfile=$ORACLE_HOME/dbs/abc123.ora
2、ORACLE启动状态:shutdown ----------->nomount -------------->mount ---------------->open