一.配置 Systemd file(开机可以自动oracle,也可以查看启动状态)
a.定义环境变量
[oracle@ol7 ~]$ cat /etc/sysconfig/DB11G.oracledb
ORACLE_BASE=/u01/app/oracleORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1ORACLE_SID=DB11G[oracle@ol7 ~]$ cat /usr/lib/systemd/system/DB11G\@DB11G@lsnrctl.service DB11G@oracledb.serviceb.配置监听服务
[oracle@ol7 ~]$ cat /usr/lib/systemd/system/DB11G\@lsnrctl.service
# this is an example, modify for free [Unit]Description=oracle net listenerAfter=network.target[Service]
Type=forkingEnvironmentFile=/etc/sysconfig/DB11G.oracledbExecStart=/u01/app/oracle/product/11.2.0.4/db_1/bin/lsnrctl startExecStop=/u01/app/oracle/product/11.2.0.4/db_1/bin/lsnrctl stopUser=oracle[Install]
WantedBy=multi-user.targetc.定义数据库服务
[oracle@ol7 ~]$ cat /usr/lib/systemd/system/DB11G\@oracledb.service # this is an example, modify for free [Unit]Description=oracle net listenerAfter=network.target lsnrctl.service[Service]
Type=forkingEnvironmentFile=/etc/sysconfig/DB11G.oracledbExecStart=/u01/app/oracle/product/11.2.0.4/db_1/bin/dbstart /u01/app/oracle/product/11.2.0.4/db_1ExecStop=/u01/app/oracle/product/11.2.0.4/db_1/bin/dbshut /u01/app/oracle/product/11.2.0.4/db_1User=oracle[Install]
WantedBy=multi-user.target[oracle@ol7 ~]$ systemctl daemon-reload [oracle@ol7 ~]$ systemctl enable DB11G@lsnrctl.service DB11G@oracledb.service这里要提前规划好相应的分区,规划好了管理才方便
mkdir -p /oracledata/nc/nctables
mkdir -p /oracledata/nc/ncindexchown -R oracle:oinstall /oracledata/nc/nctableschown -R oracle:oinstall /oracledata/nc/ncindex/chmod -R 755 /oracledata/*mkdir -p /oracletemp/DB11G/dumpchown -R oracle:oinstall /oracletemp/DB11G/dumpchmod -R 755 /oracletemp/DB11G/dump二.数据库文件
控制文件:
两个互为镜像,分配在不同的磁盘上
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------/u01/app/oracle/oradata/DB11G/control01.ctl/oraclearch/flash_recovery_area/DB11G/control02.ctlredo日志:一共四个组,每组两个成员,前期的大小是预估的,后期正常的时候,计算redo大小,再调整。
SQL> select group#, member from v$logfile; GROUP# MEMBER---------- -------------------------------------------------------------------------------- 3 /u01/app/oracle/oradata/DB11G/redo03.log 1 /u01/app/oracle/oradata/DB11G/redo01.log 2 /u01/app/oracle/oradata/DB11G/redo02.log 1 /oracle/redo1/redo01a.log 2 /oracle/redo1/redo02a.log 3 /oracle/redo1/redo03a.log 4 /u01/app/oracle/oradata/DB11G/redo04.log 4 /oracle/redo1/redo04a.log8 rows selectedSQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARCHIVED STATUS FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# NEXT_TIME---------- ---------- ---------- ---------- ---------- ---------- -------- ---------------- ------------- ----------- ------------ ----------- 1 1 361 524288000 512 2 NO CURRENT 22234232 2017/4/24 2 281474976710 2 1 359 524288000 512 2 YES INACTIVE 22205745 2017/4/24 1 22234224 2017/4/24 2 3 1 360 524288000 512 2 YES INACTIVE 22234224 2017/4/24 2 22234232 2017/4/24 2 4 1 358 524288000 512 2 YES INACTIVE 22127329 2017/4/23 2 22205745 2017/4/24 1SQL>
归档日志 archivelog:
SQL> archive log list
Database log mode Archive ModeAutomatic archival EnabledArchive destination /oracletemp/DB11G/archive_logOldest online log sequence 358Next log sequence to archive 361Current log sequence 361SQL>因为是正式的数据库。所以归档位置有两处,一处失败了,备份到另外一处,没有做镜像,因为没多的服务器
log_archive_dest_1 string location=/oraclearch/archive_l
oglog_archive_dest_10 stringlog_archive_dest_11 stringlog_archive_dest_12 stringlog_archive_dest_13 stringlog_archive_dest_14 stringlog_archive_dest_15 stringNAME TYPE VALUE
------------------------------------ ----------- ------------------------------log_archive_dest_16 stringlog_archive_dest_17 stringlog_archive_dest_18 stringlog_archive_dest_19 stringlog_archive_dest_2 string location=/oracletemp/DB11G/arc hive_log管理 undo:
查看用的那个undo表空间:
SQL> select tablespace_name,status,contents from dba_tablespaces;
TABLESPACE_NAME STATUS CONTENTS------------------------------ --------- ---------SYSTEM ONLINE PERMANENTSYSAUX ONLINE PERMANENTUNDOTBS1 ONLINE UNDOTEMP ONLINE TEMPORARYUSERS ONLINE PERMANENTNNC_DATA01 ONLINE PERMANENTNNC_INDEX01 ONLINE PERMANENT7 rows selectedSQL> show parameter undo
NAME TYPE VALUE------------------------------------ ----------- ------------------------------undo_management string AUTOundo_retention integer 900undo_tablespace string UNDOTBS1SQL>
undo_retention 内,不可以覆盖(非强制)
SQL> select tablespace_name,status,contents,retention from 2 dba_tablespaces;TABLESPACE_NAME STATUS CONTENTS RETENTION------------------------------ --------- --------- -----------SYSTEM ONLINE PERMANENT NOT APPLYSYSAUX ONLINE PERMANENT NOT APPLYUNDOTBS1 ONLINE UNDO NOGUARANTEETEMP ONLINE TEMPORARY NOT APPLYUSERS ONLINE PERMANENT NOT APPLYNNC_DATA01 ONLINE PERMANENT NOT APPLYNNC_INDEX01 ONLINE PERMANENT NOT APPLY7 rows selected自动增长减少ora_015555:过段时间数据库平稳了,再固定空间大小
SQL> select file_name,autoextensible,increment_by from dba_data_files ;
FILE_NAME AUTOEXTENSIBLE INCREMENT_BY-------------------------------------------------------------------------------- -------------- ------------/oracledata/DB11G/users01.dbf YES 160/u01/app/oracle/oradata/DB11G/undotbs01.dbf YES 640/u01/app/oracle/oradata/DB11G/sysaux01.dbf YES 1280/u01/app/oracle/oradata/DB11G/system01.dbf YES 1280/oracledata/nc/nctables/nnc_data01.dbf YES 6400/oracledata/nc/ncindex/nnc_index01.dbf YES 64006 rows selected项目的基本配置:
create user ***** identified by *****;
CREATE TABLESPACE NNC_DATA01 DATAFILE '/u01/tablespace/nnc_data01.db' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 256K ; CREATE TABLESPACE NNC_INDEX01 DATAFILE '/u01/tablespace/nnc_index01.dbf' SIZE 500M AUTOEXTEND ON NEXT 50M EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128K ;select group#,sequence#,status,bytes/1024/1024 from v$log;select group#,status,type,member from v$logfile;alter user ***** default tablespace NNC_DATA01 TEMPORARY TABLESPACE temp;GRANT connect,dba to zyctdw;CREATE USER ***** IDENTIFIED BY ***** DEFAULT TABLESPACE NNC_DATA01 TEMPORARY TABLESPACE temp; GRANT connect,dba to *****;我以前是负责公司linux运维的,这次是第一次部署公司的数据库,所以有些地方可能不妥。
---------------我是有底线的--------------------
作者:jt出处:http://www.cnblogs.com/Jt00/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如果文中有什么错误,欢迎指出。以免更多的人被误导。