12c windows auto installl

--config for oralce_env

log as must run in a command window that was opened As Administrator
(Due to Windows security, OPatch must run in a command window that was opened As Administrator)

C:\Windows\system32


step 1:

1.bat > 1.log

###file C:\Users\Administrator\1.bat  

set ORACLE_HOME=c:\app\oracle\product\12.1.0\dbhome_1
--need change ORACLE_SID/pdb_name1
set ORACLE_SID=ivrsdev12c
set pdb_name1=pivrsdev
set file_dest=c:\app\oracle\oradata

set TNS_ADMIN=c:\app\oracle\product\12.1.0\dbhome_1\network\admin
set PATH=%ORACLE_HOME%\bin;%ORACLE_HOME%\OPatch;C:\dba\utility;%PATH%


---copy

mkdir -p c:\app\software\
mkdir -p c:\app\oracle\product\12.1.0\dbhome_1

cd c:\app\software\
mkdir -p c:\app\oracle\archivelog
mkdir -p c:\app\software
mkdir -p c:\app\software\dump
mkdir -p c:\app\oracle\oradata\%ORACLE_SID%
mkdir -p c:\app\software\PSU_DB_20161018_winX64
mkdir -p c:\app\software\PSU_OJVM_20161018_winX64
mkdir -p c:\app\software\RSP
mkdir -p c:\dba\utility
mkdir -p C:\dba\change
mkdir -p C:\dba\change\db_init
mkdir -p C:\dba\utility\rman
mkdir -p c:\app\software\database

net use \\192.168.196.177 tklau5678@ /user:a\ts-dba
net view \\192.168.196.177
dir \\192.168.196.177\OraCD
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\PSU_DB_20161018_winX64  c:\app\software\PSU_DB_20161018_winX64 /D /E /Y /H /K
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\PSU_OJVM_20161018_winX64  c:\app\software\PSU_OJVM_20161018_winX64 /D /E /Y /H /K
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\env\db_init  C:\dba\change\db_init\ /D /E /Y /H /K
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\env\unzip.exe  C:\dba\utility\ /D /E /Y /H /K
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\env\rsp\db.rsp  c:\app\software\RSP\ /D /E /Y /H /K
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\p21419221_121020_MSWIN-x86-64_1of10.zip  c:\app\software\database\ /D /E /Y /H /K
xcopy \\192.168.196.177\OraCD\WIN64_12.1.0.2\p21419221_121020_MSWIN-x86-64_2of10.zip  c:\app\software\database\ /D /E /Y /H /K

net use \\192.168.196.177 /delete


###file

---edit
hostname
c:\app\software\RSP\db.rsp
--修改ORACLE_HOSTNAME主机名
检查oracle.install.OracleHomeUserPassword
--检查ORACLE_HOME
--检查ORACLE_BASE


--config for software  install

cd C:\Users\Administrator
2.bat  > 2.log

###2.bat
cd c:\app\software\PSU_OJVM_20161018_winX64
unzip p24591630_121020_MSWIN-x86-64.zip -d .
/

cd c:\app\software\database
unzip p21419221_121020_MSWIN-x86-64_1of10.zip -d .
unzip p21419221_121020_MSWIN-x86-64_2of10.zip -d .
/



cd c:\app\software\PSU_DB_20161018_winX64
unzip -o  p6880880_122010_MSWIN-x86-64.zip -d c:\app\oracle\product\12.1.0\dbhome_1\
unzip p24591642_121020_MSWIN-x86-64.zip -d .


--begin to install software

 
####
cd C:\Users\Administrator
3.bat> 3.log

cd c:\app\software\database\database
setup.exe -silent  -debug -force -waitforcompletion   -responseFile "c:\app\software\RSP\db.rsp"

--log C:\Users\sissadmin\AppData\Local\Temp  http://www.cnblogs.com/feiyun8616/p/6142179.html

--begin to apply psu (manule create )

-- if succussful. it will prompt Exit code of OUI process 0=

####
cd c:\app\software\RSP
c:\app\oracle\product\12.1.0\dbhome_1\ccr\bin\emocmrsp.bat -no_banner -output ocm.rsp

Y
\r

--
--已成功创建 OCM 配置响应文件 (ocm.rsp)。

####
cd C:\Users\Administrator
4.bat > 4.log

net stop OracleOraDB12Home1MTSRecoveryService
net stop OracleOraDB12Home1TNSListener
net stop OracleRemExecServiceV2


cd c:\app\software\PSU_DB_20161018_winX64
opatch rollback  -silent 24591642 -ocmrf c:\app\software\RSP\ocm.rsp
/

echo done


cd c:\app\software\PSU_DB_20161018_winX64
opatch apply  -silent 24591642 -ocmrf c:\app\software\RSP\ocm.rsp
/

echo done

cd c:\app\software\PSU_OJVM_20161018_winX64
opatch apply   -silent  24591630 -ocmrf c:\app\software\RSP\ocm.rsp
/

echo done




--dbca
--demo
--check administrator 属于ora_dba组
--config gdbname/sid/pdbName/memoryPercentage/serviceUserPassword

--  -serviceUserPassword is windows only
--(Doc ID 1568694.1  OPatch must run in a command window that was opened As Administrator)

#### 6

set pdb
set ORACLE
c:\>
 dbca -silent -createDatabase -templateName New_Database.dbt -gdbname %ORACLE_SID%  -sid %ORACLE_SID% -SysPassword oracle123 -systemPassword oracle123 -createAsContainerDatabase true -numberofPDBs 1  -pdbName %pdb_name1%  -pdbAdminPassword oracle123  -datafileDestination %file_dest%  -responseFile NO_VALUE -characterset AL32UTF8 -memoryPercentage 30  -emConfiguration none -storageType FS -serviceUserPassword isd.8899

清除失败的步骤
1% 已完成
正在创建并启动 Oracle 实例
2% 已完成
4% 已完成
正在创建数据库文件
7% 已完成
正在创建数据字典视图
8% 已完成

######7%

1.give oracle with administrator privileges
2.give administrator with osdba group privileges



--network 关掉防火墙

cd C:\app\oracle\product\12.1.0\dbhome_1\NETWORK\ADMIN
mkdir -p C:\app\oracle\product\12.1.0\dbhome_1\NETWORK\ADMIN\old
move *.ora .\old
move C:\dba\change\db_init\windows_crontab_network\network\* C:\app\oracle\product\12.1.0\dbhome_1\NETWORK\ADMIN\
hostname


lsnrctl start %ORACLE_SID%

isd.8899
\r


tnsping %ORACLE_SID%

conn system/oracle123@&V_CONN_STR
conn &V_CWSPUSR_UN/&V_CWSPUSR_PW@&V_CONN_STR

--clone uat to dev

cd C:\dba\change\db_init\clone_pdb

sqlplus / as sysdba
@pdb1_to_pdb2.sql
quit


--


-1.copy env_csmsdb_uat.sql to prod
-2.init tablespace and resize tablespace
-3.init user
-4.init archivelog
--5.exp and imp
----

cd C:\dba\change\user_init\log
del * /q


step 1:
cd C:\dba\change\db_init
--modify env.sql
-按照大小写各替换一次应用用户


step 2:
cd C:\dba\change\user_init
@run.sql

step 3:
check log
ps:ORA-00911: 无效字符 can ignore






conn system/oracle123@&V_CONN_STR
conn &V_testUSR_UN/&V_testUSR_PW@&V_CONN_STR

---



--run 计算机管理,任务计划程序
--view 任务计划程序,任务计划程序库
cd c:\dba\utility
copy C:\dba\change\db_init\windows_crontab_network\*.* .

--edit housekeep.bat change line 1
C:\dba\utility\housekeep.bat > C:\dba\utility\housekeep.log


--if backup is not ok,manule ,change line 1 ,600M 5minute
C:\dba\utility\rman\rman.bat > C:\dba\utility\rman\rman.log
----4.47

ngtest1:/home/dba/oracle [dtaruat] >crontab -l |grep dt
0,30 * * * * find  /dtaruatdblog  -user oracle -name '*.dbf' -ctime +2 -exec rm {} \; 1>/dev/null 2>&1
0,30 * * * * find  /dtaruatdb/adump  -user oracle -name '*.aud' -ctime +2 -exec rm {} \; 1>/dev/null 2>&1
0,30 * * * * find  /dtaruatdb/diag/rdbms/dtaruat/dtaruat/trace  -user oracle -name '*.tr*' -ctime +15 -exec rm {} \; 1>/dev/null 2>&1

---for prod

加入监控体系

10,25,40,55 * * * *   /home/oracle/utility/macro/chk_conn_12c.sh 15     >> /database/log/mon_chk_conn_12c.log 2>&1

-EDIT line 26


00 8 * * * /home/oracle/monitor/segment_size/win_rep.sh > /database/log/segment_size/tbs_win_all.log 2>&1

-edit line 18

-----
新系统db 需要申请在线级别备份的话,请开srs 让管理员帮忙处理DB 在线级别备份

posted @ 2017-01-10 14:36  feiyun8616  阅读(566)  评论(0编辑  收藏  举报