当前位置:   article > 正文

小麦苗的常用代码--常用命令(仅限自己使用)--上_zhs_notify_tools_x=74px

zhs_notify_tools_x=74px

小麦苗的常用代码--常用命令(仅限自己使用))--上

下:https://blog.csdn.net/lihuarongaini/article/details/100743572

 

  1. ·
  2. innobackupex --help
  3. -?
  4. -h
  5. help=y
  6. systeminfo | find "系统类型"
  7. ----- editplus 替换空行: ^[ \t]*\n EDIT -> DELETE->DELETE BLANK LINES
  8. ----- editplus 替换以#开头的行,多次执行: ^#[^\n]*\n
  9. windows不支持的文件名:\ / : * ? " < > |
  10. \ 反斜杠、捺斜杠
  11. / 正斜杠、撇斜杠
  12. 制表符 chr(9)
  13. 换行符 chr(10)
  14. 回车符 chr(13)
  15. 1s=1000ms(毫秒)=1000000(微秒)
  16. ------sudo
  17. vi /etc/sudoers
  18. oracle ALL=(ALL) NOPASSWD: ALL
  19. 输入wq!
  20. -------------------------------常用日期
  21. 月份 全拼 简拼 示例
  22. 1 January Jan
  23. 2 February Feb
  24. 3 March Mar
  25. 4 April Apr
  26. 5 May May
  27. 6 June Jun
  28. 7 July Jul
  29. 8 August Aug
  30. 9 September Sep
  31. 10 October Oct Sat Aug 13 10:54:45 2016
  32. 11 November Nov Tue Nov 29 02:56:59 2016
  33. 12 December Dec Tue Dec 06 08:51:57 2016
  34. 星期 全拼 简拼 示例
  35. 1 Monday Mon Mon Dec 05 01:04:18 2016
  36. 2 Tuesday Tue Tue Dec 01 16:21:37 2016
  37. 3 Wednesday Web
  38. 4 Thursday Thu Thu Dec 01 08:36:03 2016
  39. 5 Friday Fri Fri Dec 02 16:17:17 2016
  40. 6 Saturday Sat Sat Dec 10 14:13:34 2016
  41. 7 Sunday Sun
  42. ---------------------- 关闭休眠后,Hiberfil.sys自动释放
  43. powercfg -h off
  44. 休眠文件Hiberfil.sys释放C盘
  45. ---------------------------BBED
  46. 1.1 我的编译代码
  47. ls -l $ORACLE_HOME/rdbms/lib/*sbbd* */
  48. ls -l $ORACLE_HOME/rdbms/mesg/bbed* */
  49. chown oracle:dba /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/lib/*sbbd* */
  50. chown oracle:dba /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/mesg/bbed* */
  51. --cd $ORACLE_HOME/rdbms/lib
  52. --make -f ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed
  53. --make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk $ORACLE_HOME/rdbms/lib/bbed
  54. make -f $ORACLE_HOME/rdbms/lib/ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
  55. 1.2 我的使用代码
  56. vi /home/oracle/file.txt
  57. set line 9999 pagesize 9999
  58. col name format a80
  59. select file#||' '||name||' '||bytes name from v$datafile;
  60. vi /home/oracle/bbed.par
  61. blocksize=8192
  62. listfile=/home/oracle/file.txt
  63. mode=edit
  64. bbed parfile=/home/oracle/bbed.par
  65. bbed password=blockedit mode=edit blocksize=8192 listfile=/home/oracle/file.txt
  66. bbed password=blockedit blocksize=8192 mode=edit filename='/u01/app/oracle/oradata/ora11g/users01.dbf'
  67. ---------secureCRT中vi 显示彩色
  68. [root@rhel6_lhr ~]# vi .bashrc
  69. alias vi='vim'
  70. [root@rhel6_lhr ~]# vi /etc/profile
  71. export TERM=xterm-color
  72. secureCRT 中删除用 shift+delete 键或 ctrl + backspace 键
  73. ctrl+? 清理当前行命令
  74. ---------------------------- root 配置
  75. -------------- AIX
  76. chmod +w /etc/profile
  77. echo "
  78. umask 022
  79. export ORACLE_HOME=/u01/app/11.2.0/grid
  80. export PATH="\$PATH:\$ORACLE_HOME/bin"
  81. export PS1='[\$LOGNAME@'\`hostname\`:'\$PWD'']# '
  82. set -o vi
  83. alias l=\""ls -l\""
  84. alias ll=\""ls -l\""
  85. " >> /etc/profile
  86. . /etc/profile
  87. echo "
  88. umask 022
  89. export ORACLE_HOME=/u01/app/11.2.0/grid
  90. export PATH="\$PATH:\$ORACLE_HOME/bin"
  91. export PS1='[\$LOGNAME@'\`hostname\`:'\$PWD'']# '
  92. set -o vi
  93. alias l=\""ls -l\""
  94. alias ll=\""ls -l\""
  95. " >> ~/.profile
  96. . ~/.profile
  97. -------------- Linux
  98. chmod +w /etc/profile
  99. echo "
  100. umask 022
  101. export ORACLE_HOME=/u01/app/11.2.0/grid
  102. export PATH="\$PATH:\$ORACLE_HOME/bin"
  103. export PS1='[\$LOGNAME@'\`hostname\`:'\$PWD'']# '
  104. export TERM=xterm-color
  105. set -o vi
  106. alias l=\""ls -l\""
  107. alias ll=\""ls -l\""
  108. " >> /etc/profile
  109. . /etc/profile
  110. echo "
  111. umask 022
  112. export ORACLE_HOME=/u01/app/11.2.0/grid
  113. export PATH="\$PATH:\$ORACLE_HOME/bin"
  114. export PS1='[\$LOGNAME@'\`hostname\`:'\$PWD'']# '
  115. set -o vi
  116. alias l=\""ls -l\""
  117. alias ll=\""ls -l\""
  118. " >> ~/.bash_profile
  119. . ~/.bash_profile
  120. --export PS1="[\u@\h \W]\$ "
  121. --export PS1='[$LOGNAME@'`hostname`:'$PWD'']# '
  122. echo "export PS1='[\$LOGNAME@'\`hostname\`:'\$PWD'']# '" > /etc/profile
  123. export PS1='[$LOGNAME@'`hostname`:'$PWD'']# '
  124. export PS1="[\u@\h-\`echo \$ORACLE_SID\` \W]$ "
  125. -------------------------------------------------------------------------------- linux
  126. export HISTTIMEFORMAT='%F %T '
  127. export HISTSIZE=100000
  128. export HISTFILESIZE=100000
  129. Ctrl+R 搜索命令历史 ,当找到命令后,通常再按回车键就可以执行该命令。如果想对找到的命令进行调整后再执行,则可以按一下左或右方向键。ctrl+r (继续反向搜索)
  130. ------------------------------------------------------------------------------------------------- cmd 命令
  131. mstsc 远程桌面
  132. firewall.cpl 和 wf.msc 防火墙设置
  133. services.msc 服务
  134. cmd
  135. msconfig 开启启动项
  136. dxdiag Direct11
  137. ---查找文件内容
  138. findstr /S /I "普通用户" *.sql
  139. ----开启远程桌面
  140. 1、计算机——右键——属性——远程设置——远程,选中“允许允许任意版本远程桌面的计算机连接”
  141. 2、关闭防火墙
  142. netsh firewall set opmode disable
  143. netsh advfirewall set publicprofile state off
  144. 3、services.msc 打开服务,然后 找到 Remote Desktop 相关的三个服务,确保状态为“已启动”
  145. C:\Users\华荣>set /a a=8500*12
  146. 102000
  147. C:\Users\华荣>
  148. 电脑设置豆沙绿: 窗口、活动窗口标题2
  149. 色度,饱和度,亮度:85 123 205 80 100 200 100 120 200 76 91 205
  150. RGB:207,232,204
  151. [HKEY_CURRENT_USER\Control Panel\Colors] windows项 :202 234 206
  152. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\DefaultColors\Standard] --16进制:caeace
  153. 豆沙:207 232 204
  154. 最好:209 231 212 D2E7D5
  155. cmd界面背景:0,128,128 ,16进制值:#008080
  156. 代码背景:141,179,226
  157. ------- cmd 界面字体和界面背景颜色
  158. 背景颜色: 0 128 128
  159. HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe 修改%SystemRoot%_system32_cmd.exe下,若无该项可以修改HKEY_CURRENT_USER\Console下,将DWORD类型的CodePage项修改为十进制值936,将字符串类型的FaceName改为Lucida Console ,若没有该项则可以新建该项
  160. chcp 437
  161. cmd 界面按下F7显示历史命令
  162. chcp 65001 就是换成UTF-8代码页
  163. chcp 936 可以换回默认的GBK
  164. chcp 437 是美国英语
  165. dir /s /b 显示当前目录及其目录的所有文件
  166. ----cmd 下不换行
  167. host set /p=start...数据库巡检服务概要. <nul
  168. host set /p=. <nul
  169. host echo ..end
  170. ----- 锁屏 windows + L 键
  171. ----------系统环境变量
  172. Windows Registry Editor Version 5.00
  173. [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
  174. "NLS_DATE_FORMAT" "YYYY-MM-DD HH24:mi:ss"
  175. "NLS_LANG AMERICAN_AMERICA.ZHS16GBK
  176. "ORACLE10G D:\Program files\app\oracle\product\10.2.0\db_1
  177. "ORACLE11G D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  178. "ORACLE8I D:\Program files\app\oracle\product\ora8i
  179. "ORACLE9I D:\Program files\app\oracle\product\ora92
  180. "ORACLE_HOME D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  181. "TNS_ADMIN D:\Program files\app\oracle\product\11.2.0.1\dbhome_1\NETWORK\ADMIN
  182. ----------用户环境变量
  183. Windows Registry Editor Version 5.00
  184. [HKEY_CURRENT_USER\Environment]
  185. "NLS_DATE_FORMAT"="YYYY-MM-DD HH24:MI:SS"
  186. "NLS_LANG"="AMERICAN_AMERICA.ZHS16GBK"
  187. --环境变量,如果报错“ora-12705:cannot access NLS data files or invalid environment specified”,那么请将以下环境变量加入到系统的环境变量中,注意:在cmd中设置也不起作用的,必须手动加入环境变量中。
  188. ---------cmd下设置用户环境变量
  189. SETX "NLS_DATE_FORMAT" "YYYY-MM-DD HH24:MI:SS"
  190. SETX "NLS_LANG" "AMERICAN_AMERICA.ZHS16GBK"
  191. SETX "ORACLE10G" "D:\Program_files\u01\app\oracle\product\10.2.0\db_1"
  192. SETX "ORACLE11G" "D:\Program_files\u01\app\oracle\product\11.2.0.1\dbhome_1"
  193. SETX "ORACLE8I" "D:\Program_files\u01\app\oracle\product\ora8i"
  194. SETX "ORACLE9I" "D:\Program_files\u01\app\oracle\product\ora92"
  195. SETX "ORACLE_HOME" "D:\Program_files\u01\app\oracle\product\11.2.0.1\dbhome_1"
  196. SETX "TNS_ADMIN" "%ORACLE_HOME%\NETWORK\ADMIN"
  197. SETX "Path" "%ORACLE_HOME%\bin"
  198. SETX "ORACLE_HOME" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
  199. SETX "TNS_ADMIN" "%%ORACLE_HOME%%\network\admin"
  200. SETX "PATH" "%path%;%%ORACLE_HOME%%\bin"
  201. SETX "NLS_DATE_FORMAT" "YYYY-MM-DD HH24:MI:SS"
  202. SETX "NLS_LANG" "AMERICAN_AMERICA.ZHS16GBK"
  203. --日期语言环境
  204. alter session set nls_language='SIMPLIFIED CHINESE';
  205. alter system set nls_language='AMERICAN' scope=spfile;
  206. export EDITOR=vi
  207. export ORACLE_SID=orclasm
  208. export ORACLE_BASE=/u01/app/oracle
  209. export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
  210. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
  211. export ORACLE_ALERT=$ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace
  212. export PATH=$ORACLE_HOME/bin:$PATH
  213. export TNS_ADMIN=$ORACLE_HOME/network/admin
  214. export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin
  215. umask 022
  216. #export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"    SELECT userenv('LANGUAGE') db_NLS_LANG FROM DUAL;
  217. #export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  218. export SQLPATH=$ORACLE_HOME/sqlplus/admin
  219. export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
  220. export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
  221. alias sqlplus='rlwrap sqlplus'
  222. alias rman='rlwrap rman'
  223. alias asmcmd='rlwrap asmcmd'
  224. alias dgmgrl='rlwrap dgmgrl'
  225. alias alert_log='tail -200f $ORACLE_ALERT/alert_$ORACLE_SID.log'
  226. alias alert_xml='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/alert/log.xml'
  227. alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'
  228. NLS_DATE_FORMAT=YYYY-MM-DD HH24:mi:ss
  229. NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
  230. ORACLE10G=D:\Program files\app\oracle\product\10.2.0\db_1
  231. ORACLE11G=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  232. ORACLE8I=D:\Program files\app\oracle\product\ora8i
  233. ORACLE9I=D:\Program files\app\oracle\product\ora92
  234. ORACLE_HOME=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  235. PATH=%ORACLE_HOME%\bin
  236. TNS_ADMIN=%ORACLE_HOME%\NETWORK\ADMIN
  237. ---------cmd下设置用户环境变量
  238. SETX "NLS_DATE_FORMAT" "YYYY-MM-DD HH24:MI:SS"
  239. SETX "NLS_LANG" "AMERICAN_AMERICA.ZHS16GBK"
  240. SETX "ORACLE10G" "D:\Program files\app\oracle\product\10.2.0\db_1"
  241. SETX "ORACLE11G" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
  242. SETX "ORACLE8I" "D:\Program files\app\oracle\product\ora8i"
  243. SETX "ORACLE9I" "D:\Program files\app\oracle\product\ora92"
  244. SETX "ORACLE_HOME" "D:\Program files\app\oracle\product\11.2.0.1\dbhome_1"
  245. SETX "TNS_ADMIN" "%ORACLE_HOME%\NETWORK\ADMIN"
  246. SETX "Path" "%ORACLE_HOME%\bin"
  247. SETX "VBOX_MSI_INSTALL_PATH" "D:\Program Files\Oracle\VirtualBox"
  248. alter session set nls_language='SIMPLIFIED CHINESE';
  249. alter system set nls_language='AMERICAN' scope=spfile;
  250. ------------------------------------ sqlnet.ora----------------------------------------------
  251. ---------- windows
  252. SQLNET.AUTHENTICATION_SERVICES= (NTS)
  253. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)
  254. ---------- linux 建议注释掉SQLNET.AUTHENTICATION_SERVICES的值
  255. # SQLNET.AUTHENTICATION_SERVICES= (ALL)
  256. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)
  257. --------------------------------------------------------------------- oracle
  258. # .bash_profile
  259. # Get the aliases and functions
  260. if [ -f ~/.bashrc ]; then
  261. . ~/.bashrc
  262. fi
  263. # User specific environment and startup programs
  264. export PATH=$PATH:/sbin/:$HOME/bin
  265. # for oracle user
  266. unset USERNAME
  267. export GLOBAL_DB_UNIQUE_NAME=orclasm
  268. export ORACLE_HOSTNAME=192.168.128.134
  269. export ORACLE_UNQNAME=orclasm
  270. export EDITOR=vi
  271. export ORACLE_SID=orclasm
  272. export ORACLE_BASE=/u01/app/oracle
  273. export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
  274. export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
  275. export ORACLE_ALERT=$ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace
  276. export PATH=$ORACLE_HOME/bin:$PATH
  277. export TNS_ADMIN=$ORACLE_HOME/network/admin
  278. export ORACLE_PATH=.:$ORACLE_BASE/dba_scripts/sql:$ORACLE_HOME/rdbms/admin
  279. umask 022
  280. #export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"    SELECT userenv('LANGUAGE') db_NLS_LANG FROM DUAL;
  281. export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  282. export SQLPATH=$ORACLE_HOME/sqlplus/admin
  283. export NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss';
  284. alias sqlplus='rlwrap sqlplus'
  285. alias rman='rlwrap rman'
  286. alias asmcmd='rlwrap asmcmd'
  287. alias alert_log='tail -200f $ORACLE_ALERT/alert_$ORACLE_SID.log'
  288. alias alert_xml='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/alert/log.xml'
  289. alias alert_listener='tail -200f $ORACLE_BASE/diag/tnslsnr/rhel6/listener/trace/listener.log'
  290. stty erase ^h
  291. ORACLE_HOME=D:\Program files\app\oracle\product\11.2.0.1\dbhome_1
  292. PATH=%ORACLE_HOME%\bin
  293. TNS_ADMIN=%ORACLE_HOME%\NETWORK\ADMIN
  294. ##NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
  295. NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
  296. #ORACLE_SCRIPT=%ORACLE_HOME%\RDBMS\ADMIN
  297. SQLPATH=.;%ORACLE_BASE%\dba_scripts\sql;%ORACLE_HOME%\rdbms\admin
  298. NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280"
  299. NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
  300. NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  301. NLS_LANG=AMERICAN_AMERICA.UTF8
  302. NLS_LANG=AMERICAN_AMERICA.AL32UTF8
  303. NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
  304. NLS_LANG=AMERICAN_CHINA.ZHS16GBK
  305. NLS_DATE_FORMAT='YYYY-MM-DD HH24:mi:ss'
  306. --------------------------------------------------------------------- grid
  307. # .bash_profile
  308. # Get the aliases and functions
  309. if [ -f ~/.bashrc ]; then
  310. . ~/.bashrc
  311. fi
  312. # User specific environment and startup programs
  313. export PATH=$PATH:$HOME/bin
  314. # for grid user
  315. export ORACLE_SID=+ASM
  316. export ORACLE_BASE=/u01/app/grid
  317. export ORACLE_HOME=/u01/app/grid/11.2.0
  318. export LD_LIBRARY_PATH=$ORACLE_HOME/lib
  319. export PATH=$ORACLE_HOME/bin:$PATH
  320. umask 022
  321. alias sqlplus='rlwrap sqlplus'
  322. alias asmcmd='rlwrap asmcmd'
  323. alias alert_log='tail -200f $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
  324. alias crsd_log='tail -200f $ORACLE_HOME/log/$HOSTNAME/crsd/crsd.log'
  325. 在linux和unix上有时不知道该使用LD_LIBRARY_PATH还是LIBPATH,经过搜索和实际使用,实际的情况如下
  326. OS Environment Variable Name
  327. Linux LD_LIBRARY_PATH
  328. Solaris 32-bit ruby LD_LIBRARY_PATH_32 or LD_LIBRARY_PATH
  329. Solaris 64-bit ruby LD_LIBRARY_PATH_64 or LD_LIBRARY_PATH
  330. HP-UX PA-RISC 32-bit ruby SHLIB_PATH
  331. HP-UX PA-RISC 64-bit ruby LD_LIBRARY_PATH
  332. HP-UX IA64 LD_LIBRARY_PATH
  333. Mac OS X DYLD_LIBRARY_PATH
  334. AIX LIBPATH
  335. -----------------------------------------------------------------------------------------------
  336. ------------------------------------listener.ora--------------------------------------------
  337. --动态监听: alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.157)(PORT = 1521))';
  338. -----------------------------------------------------------------------------------------------
  339. # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
  340. # Generated by Oracle configuration tools.
  341. LISTENER =
  342. (DESCRIPTION_LIST =
  343. (DESCRIPTION =
  344. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))
  345. )
  346. )
  347. SID_LIST_LISTENER =
  348. (SID_LIST =
  349. (SID_DESC =
  350. (SID_NAME = PLSExtProc)
  351. (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  352. (PROGRAM = extproc)
  353. )
  354. (SID_DESC =
  355. (GLOBAL_DBNAME = orcl.lhr.com)
  356. (SID_NAME = orcl)
  357. (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  358. )
  359. (SID_DESC =
  360. (GLOBAL_DBNAME = rman.lhr.com)
  361. (SID_NAME = rman)
  362. (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  363. )
  364. )
  365. LSNR2 =
  366. (DESCRIPTION_LIST =
  367. (DESCRIPTION =
  368. (ADDRESS_LIST =
  369. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1526))
  370. )
  371. )
  372. )
  373. SID_LIST_LSNR2 =
  374. (SID_LIST =
  375. (SID_DESC =
  376. (SID_NAME = PLSExtProc)
  377. (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  378. (PROGRAM = extproc)
  379. )
  380. )
  381. ADR_BASE_LISTENER = /u01/app/oracle
  382. ------------windows 下
  383. SID_LIST_LISTENER =
  384. (SID_LIST =
  385. (SID_DESC =
  386. (SID_NAME = CLRExtProc)
  387. (ORACLE_HOME = D:\app\oracle\product\11.2.0.1)
  388. (PROGRAM = extproc)
  389. (ENVS = "EXTPROC_DLLS=ONLY:D:\app\oracle\product\11.2.0.1\bin\oraclr11.dll")
  390. )
  391. (SID_DESC =
  392. (GLOBAL_DBNAME = orcl.lhr.com)
  393. (SID_NAME = orcl)
  394. (ORACLE_HOME = D:\app\oracle\product\11.2.0.1)
  395. )
  396. )
  397. -----------------------/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
  398. # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
  399. # Generated by Oracle configuration tools.
  400. orcl =
  401. (DESCRIPTION =
  402. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.133)(PORT = 1521))
  403. (CONNECT_DATA =
  404. (SERVER = DEDICATED)
  405. (SERVICE_NAME = orcl.lhr.com)
  406. )
  407. )
  408. #### 动态监听非默认端口
  409. LSNR_ORCL =
  410. (DESCRIPTION =
  411. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1526))
  412. (CONNECT_DATA =
  413. (SERVICE_NAME = orcl)
  414. )
  415. )
  416. -------------------------------------------------------------------- rac
  417. --- TAF BASIC方式
  418. racdb_vip =
  419. (DESCRIPTION =
  420. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
  421. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))
  422. (LOAD_BALANCE = on)
  423. (CONNECT_DATA =
  424. (SERVER = DEDICATED)
  425. (SERVICE_NAME = jmrac)
  426. (FAILOVER_MODE =
  427. (TYPE = SELECT)
  428. (METHOD = BASIC)
  429. (RETRIES = 180)
  430. (DELAY = 5)
  431. )
  432. )
  433. )
  434. --- TAF preconnect方式
  435. racdb_vip1 =
  436. (DESCRIPTION =
  437. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.131)(PORT = 1521))
  438. (CONNECT_DATA =
  439. (SERVER = DEDICATED)
  440. (SERVICE_NAME = jmrac)
  441. (FAILOVER_MODE =
  442. (TYPE = SELECT)
  443. (METHOD = BASIC)
  444. (BACKUP = preconnect)
  445. )
  446. )
  447. )
  448. racdb_vip2 =
  449. (DESCRIPTION =
  450. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
  451. (CONNECT_DATA =
  452. (SERVER = DEDICATED)
  453. (SERVICE_NAME = jmrac)
  454. (FAILOVER_MODE =
  455. (TYPE = SELECT)
  456. (METHOD = BASIC)
  457. (BACKUP = preconnect)
  458. )
  459. )
  460. )
  461. ----- 如何启用 Administrator(xp、windows7)
  462. net user Administrator /active:yes
  463. 单击“开始→运行”,输入regedit后回车,打开注册表编辑器,依次展开 "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" 分支
  464. 将右边的Administrator的值改为1,即可让Administrator账户出现在登录的欢迎屏幕上。(如果没有Administrator的话就创建一个DWORD(32位)值类型,其它上级项目没有的话也依次创建)
  465. ----- 在PE中修改源系统的注册表
  466. 启动注册表编辑器,点击HKEY_LOCAL_MACHINE,然后点【文件】-【加载配置单元】,浏览文件,进入 Win7安装的分区 " c:\Windows\System32\config" 里面的SYSTEMDEFAULT、SOFTWARE都可以选择,选择后让你输入名称,随便输入,如byiu输入后点确定就会在HKEY_LOCAL_MACHINE下面增加那个分支,然后就可以编辑了。
  467. ---新建administrator
  468. 点开HKEY_LOCAL_MACHINE,点开SAM,右击SAM,点击权限..在组或用户名称下点选 Administrators,点选完全控制对应的允许复选框,点击确定
  469. 在注册表编辑器窗口按F5刷新。点开:"HKEY_LOCAL_MAICHINE\SAM\SAM\Domains\Account\Users\Names"
  470. 导入如下注册表,即Administrator用户:
  471. Windows Registry Editor Version 5.00
  472. [HKEY_LOCAL_MACHINE\SAM\SAM\Domains\Account\Users\Names\Administrator]
  473. @=hex(1f4):
  474. ----------------禁用U盘 启用U盘
  475. ----- 启用usb大容量存储设备 默认设置为“3”表示手动,“2”是表示自动,“4”是表示停用,一般设置为3
  476. --禁用
  477. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /d 4 /t reg_dword /f
  478. --启用
  479. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /d 3 /t reg_dword /f
  480. ---------------------- 查看网站是否通
  481. telnet 192.168.59.130 1158
  482. ---怎样从DOS/Linux的telnet中退出
  483. 我们经常要用到telnet来测试FTP端口,但是有一个问题估计大家都会遇到,在telnet进入某个端口后无法退出,没办法,为了继续测试只好关掉这个dos窗口,重新打开一个。 这里教给你一个方法,按住ctrl+]就可以退出到
  484. Welcome to Microsoft Telnet Client
  485. Escape Character is 'CTRL+]'
  486. Microsoft Telnet>
  487. 然后再输入quit就可以完全退出了。
  488. --退出exp或imp交互窗口:
  489. imp lhr/lhr
  490. Windows下用ctrl+c,Linux下用Ctrl+d
  491. unzip /media/linux.x64_11gR2_/linux.x64_11gR2_database_1of2.zip -d /tmp && unzip /media/linux.x64_11gR2_/linux.x64_11gR2_database_2of2.zip -d /tmp > /dev/null 2>&1
  492. unzip p10404530_112030_Linux-x86-64_1of7.zip -d /tmp && unzip p10404530_112030_Linux-x86-64_2of7.zip -d /tmp && unzip p10404530_112030_Linux-x86-64_3of7.zip -d /tmp > /dev/null 2>&1
  493. ----------------------------- 科学计数法
  494. 12345678901,结果为 1.23E+10,即 1.23 乘以 1010 次幂
  495. 12300000000
  496. 4.1E+11
  497. 410 000 000 000
  498. ------------------- 显示行号
  499. cat -n rsyslog.conf
  500. 如果要显示所有行号,使用 :set nu
  501. 如果要显示当前行号,使用 :nu
  502. 如果要跳转到指定行,使用 :行号
  503. 例如,跳转到第10行,使用 :10
  504. ----------------------------------------- crontab
  505. 每天0022 0 * * * /home/weblogic/lhr/ods_scripts/new_ods2/main_ods_entity_de_lhr.sh
  506. 每天凌晨133 1 * * * /home/weblogic/bin/crm_address_intf_1.sh
  507. 每周日180 18 * * 0 /home/weblogic/lhr/ods_scripts/new_ods2/main_weekly.sh
  508. 每周三180 18 * * 3 /home/weblogic/bin/crm_inf_linkresource_monthly.sh
  509. --root用户可以查看其它用户的crontab
  510. crontab -u zhangsan -l
  511. crontab -u lisi -l
  512. crontab -u wangwu -l
  513. nohup sh rman_backup_full.sh 2>&1 &
  514. MYDATE=`date +'%Y-%m-%d %H:%M:%S'`
  515. echo `date +'%Y-%m-%d %H:%M:%S'` >> /var/log/oraclelog
  516. sqlplus lhr/lhr@192.168.128.134:1521/orclasm.lhr.com
  517. tnsping 192.168.0.123:1521/dev.us.oracle.com
  518. drop user lhr cascade;
  519. NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280"
  520. NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
  521. NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
  522. NLS_LANG=AMERICAN_AMERICA.UTF8
  523. alias alert_log='tail -200f $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
  524. drop tablespace temp including contents and datafiles;
  525. ALTER TABLESPACE temp DROP TEMPFILE '/u01/app/oracle/oradata/orcl/orclasm/tempfile/temp.264.850260283';
  526. ALTER TABLESPACE temp ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp02.dbf' SIZE 20M;
  527. --表空间大小:
  528. set pagesize 9999 line 9999
  529. col TS_Name format a30
  530. col PDBNAME format a15
  531. col TS_NAME format a20
  532. col LOGGING format a10
  533. WITH wt1 AS
  534. (SELECT ts.TABLESPACE_NAME,
  535. df.all_bytes,
  536. decode(df.TYPE,
  537. 'D',
  538. nvl(fs.FREESIZ, 0),
  539. 'T',
  540. df.all_bytes - nvl(fs.FREESIZ, 0)) FREESIZ,
  541. df.MAXSIZ,
  542. ts.BLOCK_SIZE,
  543. ts.LOGGING,
  544. ts.FORCE_LOGGING,
  545. ts.CONTENTS,
  546. ts.EXTENT_MANAGEMENT,
  547. ts.SEGMENT_SPACE_MANAGEMENT,
  548. ts.RETENTION,
  549. ts.DEF_TAB_COMPRESSION,
  550. df.ts_df_count
  551. FROM dba_tablespaces ts,
  552. (SELECT 'D' TYPE,
  553. TABLESPACE_NAME,
  554. COUNT(*) ts_df_count,
  555. SUM(BYTES) all_bytes,
  556. SUM(decode(MAXBYTES, 0, BYTES, MAXBYTES)) MAXSIZ
  557. FROM dba_data_files d
  558. GROUP BY TABLESPACE_NAME
  559. UNION ALL
  560. SELECT 'T',
  561. TABLESPACE_NAME,
  562. COUNT(*) ts_df_count,
  563. SUM(BYTES) all_bytes,
  564. SUM(decode(MAXBYTES, 0, BYTES, MAXBYTES))
  565. FROM dba_temp_files d
  566. GROUP BY TABLESPACE_NAME) df,
  567. (SELECT TABLESPACE_NAME,
  568. SUM(BYTES) FREESIZ
  569. FROM dba_free_space
  570. GROUP BY TABLESPACE_NAME
  571. UNION ALL
  572. SELECT tablespace_name,
  573. SUM(d.BLOCK_SIZE * a.BLOCKS) bytes
  574. FROM gv$sort_usage a,
  575. dba_tablespaces d
  576. WHERE a.tablespace = d.tablespace_name
  577. GROUP BY tablespace_name) fs
  578. WHERE ts.TABLESPACE_NAME = df.TABLESPACE_NAME
  579. AND ts.TABLESPACE_NAME = fs.TABLESPACE_NAME(+))
  580. SELECT (SELECT A.TS#
  581. FROM V$TABLESPACE A
  582. WHERE A.NAME = UPPER(t.TABLESPACE_NAME)) TS#,
  583. t.TABLESPACE_NAME TS_Name,
  584. round(t.all_bytes / 1024 / 1024) ts_size_M,
  585. round(t.freesiz / 1024 / 1024) Free_Size_M,
  586. round((t.all_bytes - t.FREESIZ) / 1024 / 1024) Used_Size_M,
  587. round((t.all_bytes - t.FREESIZ) * 100 / t.all_bytes, 3) Used_per,
  588. round(MAXSIZ / 1024 / 1024/1024, 3) MAX_Size_g,
  589. round(decode(MAXSIZ, 0, to_number(NULL), (t.all_bytes - FREESIZ)) * 100 /
  590. MAXSIZ,
  591. 3) USED_per_MAX,
  592. round(t.BLOCK_SIZE) BLOCK_SIZE,
  593. t.LOGGING,
  594. t.ts_df_count
  595. FROM wt1 t
  596. UNION ALL
  597. SELECT to_number('') TS#,
  598. 'ALL TS:' TS_Name,
  599. round(SUM(t.all_bytes) / 1024 / 1024, 3) ts_size_M,
  600. round(SUM(t.freesiz) / 1024 / 1024) Free_Size_m,
  601. round(SUM(t.all_bytes - t.FREESIZ) / 1024 / 1024) Used_Size_M,
  602. round(SUM(t.all_bytes - t.FREESIZ) * 100 / SUM(t.all_bytes), 3) Used_per,
  603. round(SUM(MAXSIZ) / 1024 / 1024/1024) MAX_Size,
  604. to_number('') "USED,% of MAX Size",
  605. to_number('') BLOCK_SIZE,
  606. '' LOGGING,
  607. to_number('') ts_df_count
  608. FROM wt1 t
  609. order by TS#
  610. ;
  611. WITH wt1 AS
  612. (SELECT df.TABLESPACE_NAME,
  613. df.all_bytes,
  614. df.MAXSIZ,
  615. nvl(fs.FREESIZ, 0) FREESIZ
  616. FROM (SELECT TABLESPACE_NAME,
  617. SUM(BYTES) all_bytes,
  618. SUM(decode(MAXBYTES, 0, BYTES, MAXBYTES)) MAXSIZ
  619. FROM dba_data_files d
  620. GROUP BY TABLESPACE_NAME) df,
  621. (SELECT TABLESPACE_NAME, SUM(BYTES) FREESIZ
  622. FROM dba_free_space
  623. GROUP BY TABLESPACE_NAME) fs
  624. WHERE fs.TABLESPACE_NAME(+) = df.TABLESPACE_NAME)
  625. SELECT t.TABLESPACE_NAME TS_Name,
  626. round(t.all_bytes / 1024 / 1024, 2) ts_size_m,
  627. round(t.freesiz / 1024 / 1024, 2) Free_Size_m,
  628. round((t.all_bytes - t.FREESIZ) / 1024 / 1024, 2) Used_Size_m,
  629. round(MAXSIZ / 1024 / 1024 / 1024, 2) MAX_Size_g,
  630. round((MAXSIZ - (t.all_bytes - t.FREESIZ)) / 1024 / 1024 / 1024, 2) MAX_Size_free_g,
  631. (t.all_bytes) ts_size,
  632. (t.freesiz) Free_Size,
  633. (t.all_bytes - t.FREESIZ) Used_Size,
  634. (MAXSIZ) MAX_Size,
  635. ((MAXSIZ - (t.all_bytes - t.FREESIZ))) MAX_Size_free
  636. FROM wt1 t;
  637. ----- 12C表空间:
  638. set pagesize 9999 line 9999
  639. col TS_Name format a30
  640. col PDBNAME format a15
  641. col TS_NAME format a20
  642. col LOGGING format a10
  643. SELECT CON_ID,
  644. PDBNAME,
  645. TS#,
  646. TS_NAME,
  647. TS_SIZE_M,
  648. FREE_SIZE_M,
  649. USED_SIZE_M,
  650. USED_PER,
  651. MAX_SIZE_G,
  652. USED_PER_MAX,
  653. BLOCK_SIZE,
  654. LOGGING,
  655. TS_DF_COUNT
  656. FROM (WITH wt1 AS (SELECT ts.CON_ID,
  657. (SELECT np.NAME
  658. FROM V$CONTAINERS np
  659. WHERE np.CON_ID = tS.con_id) PDBNAME,
  660. (SELECT A.TS#
  661. FROM V$TABLESPACE A
  662. WHERE A.NAME = UPPER(tS.TABLESPACE_NAME)
  663. AND a.CON_ID = tS.con_id) TS#,
  664. ts.TABLESPACE_NAME,
  665. df.all_bytes,
  666. decode(df.TYPE,
  667. 'D',
  668. nvl(fs.FREESIZ, 0),
  669. 'T',
  670. df.all_bytes - nvl(fs.FREESIZ, 0)) FREESIZ,
  671. df.MAXSIZ,
  672. ts.BLOCK_SIZE,
  673. ts.LOGGING,
  674. ts.FORCE_LOGGING,
  675. ts.CONTENTS,
  676. ts.EXTENT_MANAGEMENT,
  677. ts.SEGMENT_SPACE_MANAGEMENT,
  678. ts.RETENTION,
  679. ts.DEF_TAB_COMPRESSION,
  680. df.ts_df_count
  681. FROM cdb_tablespaces ts,
  682. (SELECT d.CON_ID,
  683. 'D' TYPE,
  684. TABLESPACE_NAME,
  685. COUNT(*) ts_df_count,
  686. SUM(BYTES) all_bytes,
  687. SUM(decode(MAXBYTES, 0, BYTES, MAXBYTES)) MAXSIZ
  688. FROM cdb_data_files d
  689. GROUP BY d.CON_ID,
  690. TABLESPACE_NAME
  691. UNION ALL
  692. SELECT d.CON_ID,
  693. 'T',
  694. TABLESPACE_NAME,
  695. COUNT(*) ts_df_count,
  696. SUM(BYTES) all_bytes,
  697. SUM(decode(MAXBYTES, 0, BYTES, MAXBYTES))
  698. FROM cdb_temp_files d
  699. GROUP BY d.CON_ID,
  700. TABLESPACE_NAME) df,
  701. (SELECT d.CON_ID,
  702. TABLESPACE_NAME,
  703. SUM(BYTES) FREESIZ
  704. FROM cdb_free_space d
  705. GROUP BY d.CON_ID,
  706. TABLESPACE_NAME
  707. UNION ALL
  708. SELECT d.CON_ID,
  709. tablespace_name,
  710. SUM(d.BLOCK_SIZE * a.BLOCKS) bytes
  711. FROM gv$sort_usage a,
  712. cdb_tablespaces d
  713. WHERE a.tablespace = d.tablespace_name
  714. AND a.CON_ID = d.CON_ID
  715. GROUP BY d.CON_ID,
  716. tablespace_name) fs
  717. WHERE ts.TABLESPACE_NAME = df.TABLESPACE_NAME
  718. AND ts.CON_ID = df.CON_ID
  719. AND ts.TABLESPACE_NAME = fs.TABLESPACE_NAME(+)
  720. AND ts.CON_ID = fs.CON_ID(+))
  721. SELECT T.CON_ID,
  722. (CASE
  723. WHEN T.PDBNAME = LAG(T.PDBNAME, 1)
  724. OVER(PARTITION BY T.PDBNAME ORDER BY TS#) THEN
  725. NULL
  726. ELSE
  727. T.PDBNAME
  728. END) PDBNAME,
  729. TS#,
  730. t.TABLESPACE_NAME TS_Name,
  731. round(t.all_bytes / 1024 / 1024) ts_size_M,
  732. round(t.freesiz / 1024 / 1024) Free_Size_M,
  733. round((t.all_bytes - t.FREESIZ) / 1024 / 1024) Used_Size_M,
  734. round((t.all_bytes - t.FREESIZ) * 100 / t.all_bytes, 3) Used_per,
  735. round(MAXSIZ / 1024 / 1024 / 1024, 3) MAX_Size_g,
  736. round(decode(MAXSIZ,
  737. 0,
  738. to_number(NULL),
  739. (t.all_bytes - FREESIZ)) * 100 / MAXSIZ,
  740. 3) USED_per_MAX,
  741. round(t.BLOCK_SIZE) BLOCK_SIZE,
  742. t.LOGGING,
  743. t.ts_df_count
  744. FROM wt1 t
  745. UNION ALL
  746. SELECT DISTINCT T.CON_ID,
  747. '' PDBNAME,
  748. to_number('') TS#,
  749. 'ALL TS:' TS_Name,
  750. round(SUM(t.all_bytes) / 1024 / 1024, 3) ts_size_M,
  751. round(SUM(t.freesiz) / 1024 / 1024) Free_Size_m,
  752. round(SUM(t.all_bytes - t.FREESIZ) / 1024 / 1024) Used_Size_M,
  753. round(SUM(t.all_bytes - t.FREESIZ) * 100 /
  754. SUM(t.all_bytes),
  755. 3) Used_per,
  756. round(SUM(MAXSIZ) / 1024 / 1024 / 1024) MAX_Size,
  757. to_number('') "USED,% of MAX Size",
  758. to_number('') BLOCK_SIZE,
  759. '' LOGGING,
  760. to_number('') ts_df_count
  761. FROM wt1 t
  762. GROUP BY rollup(CON_ID,PDBNAME)
  763. )
  764. ORDER BY CON_ID,TS# ;
  765. ------ 数据文件情况
  766. SELECT d.FILE_ID,
  767. d.TABLESPACE_NAME,
  768. (SELECT round(SUM(nb.BYTES) / 1024 / 1024, 2)
  769. FROM dba_data_files nb
  770. WHERE nb.TABLESPACE_NAME = d.TABLESPACE_NAME) ts_size_m,
  771. d.FILE_NAME,
  772. round(d.BYTES / 1024 / 1024, 2) file_size_m,
  773. round(d.MAXBYTES / 1024 / 1024 / 1024, 2) file_max_size_G,
  774. d.AUTOEXTENSIBLE,
  775. round(d.INCREMENT_BY * 8 * 1024 / 1024 / 1024, 2) INCREMENT_m,
  776. round(d.BYTES * 100 / decode(d.MAXBYTES, 0, BYTES, d.MAXBYTES), 2) autoextend_ratio,
  777. (SELECT b.CREATION_TIME
  778. FROM sys.v_$datafile b
  779. where b.FILE# = d.FILE_ID) CREATION_TIME,
  780. d.INCREMENT_BY INCREMENT_BY_block,
  781. d.BYTES,
  782. d.blocks,
  783. d.MAXBYTES,
  784. d.MAXBLOCKS,
  785. d.USER_BYTES,
  786. d.USER_BLOCKS
  787. FROM dba_data_files d
  788. UNION ALL
  789. SELECT d.FILE_ID,
  790. d.TABLESPACE_NAME,
  791. (SELECT round(SUM(nb.BYTES) / 1024 / 1024, 2)
  792. FROM v$tempfile nb
  793. WHERE nb.name = d.FILE_NAME) ts_size,
  794. d.FILE_NAME,
  795. round(d.BYTES / 1024 / 1024, 2) file_size_m,
  796. round(d.MAXBYTES / 1024 / 1024 / 1024, 2) file_max_size_G,
  797. d.AUTOEXTENSIBLE,
  798. round(d.INCREMENT_BY * 8 * 1024 / 1024 / 1024, 2) INCREMENT_m,
  799. round(d.BYTES * 100 / decode(d.MAXBYTES, 0, BYTES, d.MAXBYTES), 2) autoextend_ratio,
  800. (SELECT b.CREATION_TIME
  801. FROM sys.v_$datafile b
  802. where b.FILE# = d.FILE_ID) CREATION_TIME,
  803. d.INCREMENT_BY INCREMENT_BY_block,
  804. d.BYTES,
  805. d.blocks,
  806. d.MAXBYTES,
  807. d.MAXBLOCKS,
  808. d.USER_BYTES,
  809. d.USER_BLOCKS
  810. FROM dba_temp_files d
  811. ORDER BY TABLESPACE_NAME, file_id;
  812. ----12c的数据文件
  813. SELECT FILE_ID,
  814. CON_ID,
  815. (CASE
  816. WHEN T.PDBNAME = LAG(T.PDBNAME, 1)
  817. OVER(PARTITION BY T.PDBNAME ORDER BY TS#) THEN
  818. NULL
  819. ELSE
  820. T.PDBNAME
  821. END) PDBNAME,
  822. TS#,
  823. TABLESPACE_NAME,
  824. TS_SIZE_M,
  825. FILE_NAME,
  826. FILE_SIZE_M,
  827. FILE_MAX_SIZE_G,
  828. AUTOEXTENSIBLE,
  829. INCREMENT_M,
  830. AUTOEXTEND_RATIO,
  831. CREATION_TIME,
  832. INCREMENT_BY_BLOCK,
  833. BYTES,
  834. BLOCKS,
  835. MAXBYTES,
  836. MAXBLOCKS,
  837. USER_BYTES,
  838. USER_BLOCKS
  839. FROM (SELECT D.FILE_ID,
  840. D.CON_ID,
  841. (SELECT NP.NAME
  842. FROM V$CONTAINERS NP
  843. WHERE NP.CON_ID = D.CON_ID) PDBNAME,
  844. (SELECT A.TS#
  845. FROM V$TABLESPACE A
  846. WHERE A.NAME = UPPER(D.TABLESPACE_NAME)
  847. AND A.CON_ID = D.CON_ID) TS#,
  848. D.TABLESPACE_NAME,
  849. (SELECT ROUND(SUM(NB.BYTES) / 1024 / 1024, 2)
  850. FROM CDB_DATA_FILES NB
  851. WHERE NB.TABLESPACE_NAME = D.TABLESPACE_NAME
  852. AND NB.CON_ID = D.CON_ID) TS_SIZE_M,
  853. D.FILE_NAME,
  854. ROUND(D.BYTES / 1024 / 1024, 2) FILE_SIZE_M,
  855. ROUND(D.MAXBYTES / 1024 / 1024 / 1024, 2) FILE_MAX_SIZE_G,
  856. D.AUTOEXTENSIBLE,
  857. ROUND(D.INCREMENT_BY * 8 * 1024 / 1024 / 1024, 2) INCREMENT_M,
  858. ROUND(D.BYTES * 100 /
  859. DECODE(D.MAXBYTES, 0, BYTES, D.MAXBYTES),
  860. 2) AUTOEXTEND_RATIO,
  861. (SELECT B.CREATION_TIME
  862. FROM SYS.V_$DATAFILE B
  863. WHERE B.FILE# = D.FILE_ID
  864. AND B.CON_ID = D.CON_ID) CREATION_TIME,
  865. D.INCREMENT_BY INCREMENT_BY_BLOCK,
  866. D.BYTES,
  867. D.BLOCKS,
  868. D.MAXBYTES,
  869. D.MAXBLOCKS,
  870. D.USER_BYTES,
  871. D.USER_BLOCKS
  872. FROM CDB_DATA_FILES D
  873. UNION ALL
  874. SELECT D.FILE_ID,
  875. D.CON_ID,
  876. (SELECT NP.NAME
  877. FROM V$CONTAINERS NP
  878. WHERE NP.CON_ID = D.CON_ID) PDBNAME,
  879. (SELECT A.TS#
  880. FROM V$TABLESPACE A
  881. WHERE A.NAME = UPPER(D.TABLESPACE_NAME)
  882. AND A.CON_ID = D.CON_ID) TS#,
  883. D.TABLESPACE_NAME,
  884. (SELECT ROUND(SUM(NB.BYTES) / 1024 / 1024, 2)
  885. FROM V$TEMPFILE NB
  886. WHERE NB.NAME = D.FILE_NAME
  887. AND NB.CON_ID = D.CON_ID) TS_SIZE,
  888. D.FILE_NAME,
  889. ROUND(D.BYTES / 1024 / 1024, 2) FILE_SIZE_M,
  890. ROUND(D.MAXBYTES / 1024 / 1024 / 1024, 2) FILE_MAX_SIZE_G,
  891. D.AUTOEXTENSIBLE,
  892. ROUND(D.INCREMENT_BY * 8 * 1024 / 1024 / 1024, 2) INCREMENT_M,
  893. ROUND(D.BYTES * 100 /
  894. DECODE(D.MAXBYTES, 0, BYTES, D.MAXBYTES),
  895. 2) AUTOEXTEND_RATIO,
  896. (SELECT B.CREATION_TIME
  897. FROM SYS.V_$DATAFILE B
  898. WHERE B.FILE# = D.FILE_ID
  899. AND B.CON_ID = D.CON_ID) CREATION_TIME,
  900. D.INCREMENT_BY INCREMENT_BY_BLOCK,
  901. D.BYTES,
  902. D.BLOCKS,
  903. D.MAXBYTES,
  904. D.MAXBLOCKS,
  905. D.USER_BYTES,
  906. D.USER_BLOCKS
  907. FROM CDB_TEMP_FILES D) T
  908. ORDER BY CON_ID,
  909. TS#,
  910. FILE_ID;
  911. ------------含LOB字段的用户大小
  912. SELECT
  913. trunc(((SELECT SUM(S.BYTES) -- The Table Segment size
  914. FROM DBA_SEGMENTS S
  915. WHERE S.OWNER = UPPER('HTSEC_ADMIN')) +
  916. (SELECT SUM(S.BYTES) -- The Lob Segment Size
  917. FROM DBA_SEGMENTS S, DBA_LOBS L
  918. WHERE S.OWNER = UPPER('HTSEC_ADMIN') AND
  919. (L.SEGMENT_NAME = S.SEGMENT_NAME AND L.OWNER = UPPER('HTSEC_ADMIN'))) +
  920. (SELECT SUM(S.BYTES) -- The Lob Index size
  921. FROM DBA_SEGMENTS S, DBA_INDEXES I
  922. WHERE S.OWNER = UPPER('HTSEC_ADMIN') AND
  923. (I.INDEX_NAME = S.SEGMENT_NAME AND INDEX_TYPE = 'LOB' AND I.OWNER = UPPER('HTSEC_ADMIN'))))/1024/1024/1024,2)
  924. "TOTAL TABLE SIZE (G)"
  925. FROM DUAL;
  926. ACCEPT SCHEMA PROMPT 'Table Owner: '
  927. ACCEPT TABNAME PROMPT 'Table Name: '
  928. SELECT (SELECT SUM(S.BYTES) -- The Table Segment size
  929. FROM DBA_SEGMENTS S
  930. WHERE S.OWNER = UPPER('&SCHEMA')
  931. AND (S.SEGMENT_NAME = UPPER('&TABNAME'))) +
  932. (SELECT SUM(S.BYTES) -- The Lob Segment Size
  933. FROM DBA_SEGMENTS S,
  934. DBA_LOBS L
  935. WHERE S.OWNER = UPPER('&SCHEMA')
  936. AND (L.SEGMENT_NAME = S.SEGMENT_NAME AND
  937. L.TABLE_NAME = UPPER('&TABNAME') AND
  938. L.OWNER = UPPER('&SCHEMA'))) +
  939. (SELECT SUM(S.BYTES) -- The Lob Index size
  940. FROM DBA_SEGMENTS S,
  941. DBA_INDEXES I
  942. WHERE S.OWNER = UPPER('&SCHEMA')
  943. AND (I.INDEX_NAME = S.SEGMENT_NAME AND
  944. I.TABLE_NAME = UPPER('&TABNAME') AND INDEX_TYPE = 'LOB' AND
  945. I.OWNER = UPPER('&SCHEMA'))) "TOTAL TABLE SIZE"
  946. FROM DUAL;
  947. -----查看字符集
  948. 0001 US7ASCII
  949. 0369 AL32UTF8
  950. 0354 ZHS16GBK
  951. SELECT NLS_CHARSET_NAME(TO_NUMBER('0001', 'XXXX')) US7ASCII,
  952. NLS_CHARSET_NAME(TO_NUMBER('0354', 'XXXX')) ZHS16GBK,
  953. NLS_CHARSET_NAME(TO_NUMBER('0369', 'XXXX')) AL32UTF8,
  954. TO_CHAR(NLS_CHARSET_ID('US7ASCII'), 'XXXX') US7ASCII_ID,
  955. TO_CHAR(NLS_CHARSET_ID('ZHS16GBK'), 'XXXX') ZHS16GBK_ID,
  956. TO_CHAR(NLS_CHARSET_ID('AL32UTF8'), 'XXXX') AL32UTF8_ID
  957. FROM DUAL;
  958. select SYS_CONTEXT('USERENV', 'LANGUAGE') from dual;
  959. select userenv('language') from dual;
  960. select * from v$nls_parameters;
  961. ---密码文件 linux区分$ORACLE_SID大小写 sysdba select* from v$pwfile_users;
  962. --linux:orapw+$ORACLE_SID
  963. --windows: pwd+$ORACLE_SID.ora
  964. orapwd file='+data/lhrracphy/PASSWORD/pwdlhrracphy' force=y dbuniquename=lhrracphy format=12 password=lhr
  965. orapwd file='+data' force=y dbuniquename=lhrracphy format=12 password=lhr
  966. orapwd file='+data/HTZXDBPRI/password/orapwhtzxdbpri' force=y dbuniquename=htzxdbpri format=12 sys=oracle sysbackup=oracle sysdg=oracle syskm=oracle
  967. orapwd input_file='+data/HTZXDBPRI/password/orapwhtzxdbpri' file='+ocr/asm/password/orapwASM' asm=y force=y
  968. srvctl config db -d htzxdbpri -a
  969. srvctl modify db -d htzxdbpri -pwfile '+data/HTZXDBPRI/password/orapwhtzxdbpri'
  970. oradim -NEW -sid orcl9i -INTPWD admin -pfile d:\oracle\ora90\database\initstorm.ora;
  971. C:\Users\Administrator> orapwd file="E:\oracle\ora8i\DATABASE\PWDortest.ORA" password=lhr
  972. [oracle@robinson dbs]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=oracle force=y
  973. --卸载Windows下服务 卸载服务
  974. sc delete OracleOraDb11g_home1TNSListener
  975. sc create OracleOraDb11g_home1TNSListener binpath= "F:\app\oracle\product\BIN\TNSLSNR" start= auto displayname= "OracleOraDb11g_home1TNSListener"
  976. --11g中密码大小写敏感
  977. 1) sec_case_sensitive_logon参数可以指定用户的口令是否区分大小写,默认为true,表示区分大小写
  978. 2) 口令文件中的ignorecase 参数仅仅针对创建时是否区分大小写,简言之,只能针对SYS用户,默认为N,表示不忽略大小写,即区分大小写
  979. --通过设置EVENTS 28401可以屏蔽密码延迟验证:
  980. --SQL> ALTER SYSTEM SET EVENT = '28401 TRACE NAME CONTEXT FOREVER, LEVEL 1' SCOPE = SPFILE; --设置该事件后重启数据库即可。
  981. ALTER SYSTEM SET EVENTS '28401 TRACE NAME CONTEXT FOREVER, LEVEL 1';--屏蔽密码延迟验证
  982. ------------------------------------------------ selinux
  983. 查看SELinux状态:
  984. 1/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态
  985. SELinux status:                 enabled
  986. 2、getenforce                 ##也可以用这个命令检查
  987. 关闭SELinux:
  988. 1、临时关闭(不用重启机器):
  989. setenforce 0                  ##设置SELinux 成为permissive模式
  990.                               ##setenforce 1 设置SELinux 成为enforcing模式
  991. 2、修改配置文件需要重启机器:
  992. 修改/etc/selinux/config 文件
  993. 将SELINUX=enforcing改为SELINUX=disabled
  994. 重启机器即可
  995. ------------------------------------------------------------ linux
  996. 存储区域网络(Storage Area Network,SAN)
  997. ----设置密码永不过期:
  998. chage -M -1 oracle
  999. chage -l oracle
  1000. lsb_release-a
  1001. cat /etc/issue
  1002. uname -a
  1003. cat /proc/version
  1004. ---linux位数查看
  1005. file /bin/ls
  1006. getconf _BIT
  1007. arch
  1008. ---AIX系统查看
  1009.   显示AIX系统内核是32位还是64位:
  1010.   bootinfo -K
  1011.   显示机器硬件是32位还是64位:
  1012.   bootinfo -y
  1013.  --- SUN:
  1014.   $isainfo -bv
  1015.   64表示内核是64位的,32表示内核是32位的
  1016.  --- HPUX:
  1017.   >getconf KERNEL_BITS
  1018.   64表示内核是64位的,32表示内核是32位的
  1019.   HPUX:
  1020.   >getconf KERNEL_BITS
  1021.   64表示内核是64位的,32表示内核是32位的
  1022. ------------------ AIX系统用户解锁
  1023. 3.1 AIX用户账户锁定与解锁最佳方法
  1024. 3004-303 There have been too many unsuccessful login attempts; please see
  1025.         the system administrator.
  1026. 与之相关的配置参数是/etc/security/login.cfg的以下配置项
  1027. logindisable=7              *7次失败登录后锁定端口
  1028. logininterval=120            *120秒内7次失败登录才锁定端口
  1029. 1、如果你可以登陆到ROOT账户,比较简单
  1030. 使用chsec命令即可解锁,具体如下:
  1031. # chsec -/etc/security/lastlog -a unsuccessful_login_count=0 -s  username
  1032. 通过重置未成功登陆的次数即可解锁
  1033. 2、如果是通过设置来锁定的用户,可以这样解锁
  1034. #【smitty user-->【Lock / Unlock a User's Account】
  1035. 或是
  1036. # chsec -/etc/security/lastlog -a unsuccessful_login_count=0 -s  username
  1037. 3、命令解锁
  1038. # chuser account_locked=TRUE username  给用户加锁
  1039. # chuser accout_locked=FALSE username   给用户解锁
  1040. ------------大写G跳到最后一行,o新插入一行
  1041. AIX开启自动补全:
  1042. 方法一:
  1043. set -o vi
  1044. 自动补全 esc \
  1045. 历史命令 esc -
  1046. HJKL
  1047. 左下上右
  1048. A 跳到行末,进入编辑模式
  1049. I 跳到行首,进入编辑模式
  1050. X 键删除光标前一个字符停留在原来的那个字符
  1051. AIX开启自动补全:
  1052. 方法一:
  1053. set -o vi
  1054. 自动补全 esc \
  1055. 历史命令 esc -
  1056. esc j
  1057. esc k
  1058. i a x 编辑
  1059. 光标移动 : h l
  1060. HJKL
  1061. 左下上右
  1062. A 跳到行末,进入编辑模式
  1063. I 跳到行首,进入编辑模式
  1064. X 键删除光标前一个字符停留在原来的那个字符
  1065. 方法二:
  1066. set -o emacs
  1067. 自动补全 按两次esc
  1068. 历史命令 ctrl-n 或 ctrl-p
  1069. more /etc/profile
  1070. more /etc/environment
  1071. export TMOUT=0;
  1072. oslevel -qs
  1073. ---清磁盘头
  1074. dd if=/dev/zero of=/dev/rhdisk5 bs=1024 count=1024
  1075. ##查看PV大小,单位M AIX 查询磁盘大小 硬盘大小
  1076. for HDISK in `lspv | grep -v hdisk0 | awk '{print $1}'`;do
  1077. bootinfo -s $HDISK
  1078. done
  1079. for diskname in `lspv|grep -i none|cut -f "1" -d ' '`
  1080. do
  1081. echo "/dev/r$diskname" `getconf DISK_SIZE /dev/r$diskname`
  1082. done
  1083. ---进程句柄
  1084. lsof -p pid
  1085. ---告警日志位置
  1086. lsof | grep diag
  1087. lsof | grep bdump
  1088. show parameter background_dump_dest
  1089. $ORACLE_BASE/ADMIN/SID/BDUMP/ALERTSID.LOG
  1090. --根据实际情况决定是否加upper函数
  1091. SELECT VALUE || substr(d.VALUE, -6, 1) || 'alert_' || b.INSTANCE_Name ||'.log' alertname
  1092. FROM v$parameter d, v$instance b
  1093. WHERE d.NAME = 'background_dump_dest';
  1094. --1 端口是否占用
  1095. netstat -apn | grep 1521
  1096. netstat -ano|grep 1521
  1097. netstat -lnp|grep 1521
  1098. --windows
  1099. netstat -ano | findstr "1521"
  1100. tasklist | findstr "3572"
  1101. ----检查包忽略大小写
  1102. rpm -qa | grep -i AAA
  1103. --2 杀死所有进程
  1104. kill -9 `ps -ef|grep orcl| grep -v grep | awk '{print $2}'`
  1105. ps -ef |grep $ORACLE_SID|grep -v grep|awk '{print $2}' | xargs kill -9
  1106. ipcs -m | grep oracle | awk '{print $2}' | xargs ipcrm shm
  1107. ipcs
  1108. ipcs -m
  1109. ipcrm -m 1048583
  1110. sysresv
  1111. --进程总数
  1112. ps -ef|grep orcl| wc -l
  1113. ---统计行数
  1114. wc - lcw a.txt
  1115.  - c 统计字节数。
  1116.   - l 统计行数。
  1117.   - w 统计字数。
  1118. -- 匹配多个进程号
  1119. [root@node1 node1]# ps -ef | grep ' 27373 \| 27182 '
  1120. oracle 27182 1 0 14:50 ? 00:00:00 ora_pz99_jmrac1
  1121. oracle 27373 1 0 14:53 ? 00:00:00 ora_w000_jmrac1
  1122. root 27574 9150 0 14:56 pts/1 00:00:00 grep 27373 \| 27182
  1123. [oracle@orcltest shm]$ ps -ef | egrep '(12545|12543)' |grep -v grep
  1124. oracle 12543 1 0 07:41 ? 00:00:02 ora_pmon_ogg1
  1125. oracle 12545 1 0 07:41 ? 00:00:04 ora_psp0_ogg1
  1126. [oracle@orcltest shm]$
  1127. -- 匹配多个字符串
  1128. [root@node1 node1]# ps -ef | grep -v grep | grep -E "ohasd.bin|crs|ocssd|evmd|oproc"
  1129. root 2372 1 0 09:33 ? 00:00:25 /u01/grid/bin/crsd.bin reboot
  1130. root 5051 1 0 05:36 ? 00:01:02 /u01/grid/bin/ohasd.bin reboot
  1131. grid 5313 1 0 05:37 ? 00:01:45 /u01/grid/bin/ocssd.bin
  1132. grid 5500 1 0 05:37 ? 00:00:13 /u01/grid/bin/evmd.bin
  1133. [root@node1 node1]#
  1134. --3 关闭防火墙
  1135. chkconfig iptables off ---永久
  1136. service iptables stop ---临时
  1137. chkconfig iptables --list
  1138. /etc/init.d/iptables status ----会得到一系列信息,说明防火墙开着。
  1139. /etc/rc.d/init.d/iptables stop ----------关闭防火墙
  1140. setup ----------图形界面
  1141. --将/etc/sysconfig/iptables文件新增一行,表示允许1521端口访问:
  1142. [root@dcsopen2Node sysconfig]# vi /etc/sysconfig/iptables
  1143. # Firewall configuration written by system-config-firewall
  1144. # Manual customization of this file is not recommended.
  1145. *filter
  1146. :INPUT ACCEPT [0:0]
  1147. :FORWARD ACCEPT [0:0]
  1148. :OUTPUT ACCEPT [0:0]
  1149. -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  1150. -A INPUT -p icmp -j ACCEPT
  1151. -A INPUT -i lo -j ACCEPT
  1152. -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
  1153. -A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
  1154. -A INPUT -j REJECT --reject-with icmp-host-prohibited
  1155. -A FORWARD -j REJECT --reject-with icmp-host-prohibited
  1156. COMMIT
  1157. find / -type f -size +10000000c -exec du -sh {} \; 查找大于10M的文件
  1158. find . -name '*.phtml' -type f -mmin -30 查找当前目录下.phtml文件中,最近30分钟内修改过的文件。
  1159. find . -name '*.phtml' -type f -mmin -30 -ls 查找当前目录下.phtml文件中,最近30分钟内修改过的文件,的详细情况。
  1160. find . -type f -mtime -1 查找当前目录下,最近1天内修改过的常规文件
  1161. find . -type f -mtime +1 查找当前目录下,最近1天前(2天内)修改过的常规文件。
  1162. find . -ctime +3 -exec rm -rf {} \; #删除一个目录下几天前的文件和目录
  1163. find / -type f -size +10000000c -exec du -sh {} \; 2>/dev/null #查找大于10M的文件并列出文件大小
  1164. find /home -size +10k #意思是说查找/home目录下大小为10k的文件
  1165. find . -type f -mtime 0
  1166. find . -type f -mtime +1
  1167. find . -name '*.doc' -mtime 0
  1168. find / -name access_log 2>/dev/null
  1169. find . -name '*.doc' 2>/dev/null
  1170. find / -amin -10 # 查找在系统中最后10分钟访问的文件
  1171. find / -atime -2 # 查找在系统中最后48小时访问的文件
  1172. find /tmp -size +10000000c -and -mtime +2
  1173. find /tmp -size +10000000c -or -mtime +2
  1174. find / -empty # 查找在系统中为空的文件或者文件夹
  1175. find / -group cat # 查找在系统中属于 groupcat的文件
  1176. find / -mmin -5 # 查找在系统中最后5分钟里修改过的文件
  1177. find / -mtime -1 #查找在系统中最后24小时里修改过的文件
  1178. find / -nouser #查找在系统中属于作废用户的文件
  1179. find / -user fred #查找在系统中属于FRED这个用户的文件
  1180. find . -type f -mtime 0 -exec ls -lrt {} \; --查看当天修改过的文件
  1181. find . -type f -mtime 0 #最近24小时内修改过的文件
  1182. find . -type f -mtime 1 #前48~24小时内修改过的文件,而不是48小时以内修改过的文件
  1183. ---近3天内修改过的文件
  1184. find . -type f -mtime 0 -o -mtime 1 -o -mtime 2
  1185. find . -type f -mtime 0 -or -mtime 1 -or -mtime 2
  1186. 目录大小: du -h --max-depth=1 . 2>&1
  1187. du -h --max-depth=0 /tmp/database/
  1188. du -sh database/
  1189. find . -ctime +3 -exec rm -rf {} \; 删除一个目录下几天前的文件和目录
  1190. find / -type f -size +10000000c -exec du -sh {} \; 查找大于10M的文件
  1191. du -s /*|sort -rn 查看目录大小
  1192. /**/
  1193. -------- AIX文件夹大小
  1194. du -sg app/11.2.0/grid/* | sort -rn /* */
  1195. du -ag app/11.2.0/grid/* | sort -rn /* */
  1196. du -g /oracle/app/11.2.0/* | sort -rn | more /* */
  1197. 系统启动时间:
  1198. date -d "$(awk -F. '{print $1}' /proc/uptime) second ago" +"%Y-%m-%d %H:%M:%S"
  1199. create public database link dblink_ogg1
  1200. connect to lhr identified by lhr
  1201. using '(DESCRIPTION =
  1202.    (ADDRESS_LIST =
  1203.    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.59.129)(PORT = 1521))
  1204.    )
  1205.    (CONNECT_DATA =
  1206.    (SERVICE_NAME = ogg1)
  1207.    )
  1208.    )';
  1209. create public database link DBLINK_OGG1
  1210. connect to LHR identified by lhr
  1211. using 'OGG1';
  1212. --ORA-00600: internal error code, arguments: [kzdlk_zt2 err],
  1213. create public database link DBLINK_OGG1
  1214. connect to LHR identified by values '72979A94BAD2AF80'
  1215. using 'OGG1';
  1216. CREATE DATABASE LINK DBLINK_OGG1
  1217. CONNECT TO CURRENT_USER
  1218. USING 'remote';
  1219. CREATE DATABASE LINK DBLINK_OGG1
  1220. USING 'remote';
  1221. ----linux查看文件的详细时间
  1222. ls ctlfile*20150212* --full-time|awk '{print $6,$7,$9}'
  1223. -----------添加磁盘
  1224. fdisk -l
  1225. fdisk /dev/sdf
  1226. ...
  1227. mkfs.ext4 /dev/sdf1
  1228. [root@rhel6_lhr ~]# mkdir /u03
  1229. [root@rhel6_lhr ~]# mount /dev/sdf1 /u03
  1230. [root@rhel6_lhr ~]# vi /etc/fstab
  1231. /dev/sdf1 /u03 ext4 defaults 0 0
  1232. chown oracle:oinstall /u04
  1233. linux 修改主机名,永久生效:
  1234. vim /etc/sysconfig/network
  1235. vim /etc/hosts
  1236. ---- RHEL 7 CentOS 7 修改主机名
  1237. hostnamectl set-hostname raclhr-19c-n1
  1238. aix 修改主机名:
  1239. 修改主机名暂时生效:
  1240. hostname NEW_HOSTNAME
  1241. 永久生效 smit hostname
  1242. 或者 smit tcpip - futher configureation - hostname -set the hostname
  1243. uname -S hostname
  1244. 或者直接用命令 chdev -l inet0 -a hostname=NEW_HOSTNAME
  1245. ||||||||||||||||||||
  1246. 正确更改IP 地址是用 smit tcpip 进入菜单之后,选择further configuration 再选 Network Interfaces,再选 Network Interface Selection,
  1247. 再选 Change /show characteristic of a network interface来更改 IP,这样/etc/hosts就不会新加入一条记录,只需更改文件中相应的IP就行了。
  1248. -------------------------------------------------------------- 闪回恢复区满
  1249. select * from v$flash_recovery_area_usage;
  1250. ALTER SYSTEM SET db_recovery_file_dest_size='2G';
  1251. --关闭闪回恢复区
  1252. alter system set db_recovery_file_dest='';
  1253. col name format a6
  1254. SELECT NAME,
  1255. TRUNC(SPACE_LIMIT/1024/1024/1024, 3) LIMIT_GB,
  1256. TRUNC(SPACE_USED/1024/1024/1024, 3) USED_GB,
  1257. TRUNC(SPACE_USED / SPACE_LIMIT, 3) "USED%",
  1258. TRUNC(SPACE_RECLAIMABLE, 3) RECLAIM,
  1259. NUMBER_OF_FILES
  1260. FROM V$RECOVERY_FILE_DEST V
  1261. WHERE V.SPACE_LIMIT <> 0;
  1262. SELECT NVL(FRAU.FILE_TYPE, 'Total:') FILE_TYPE,
  1263. SUM(ROUND(FRAU.PERCENT_SPACE_USED / 100 * RFD.SPACE_LIMIT / 1024 / 1024 / 1024,3)) USED_GB,
  1264. SUM(FRAU.PERCENT_SPACE_USED) PERCENT_SPACE_USED,
  1265. SUM(FRAU.PERCENT_SPACE_RECLAIMABLE) PERCENT_SPACE_RECLAIMABLE,
  1266. SUM(ROUND(FRAU.PERCENT_SPACE_RECLAIMABLE / 100 * RFD.SPACE_LIMIT / 1024 / 1024 / 1024,3)) RECLAIM_GB,
  1267. SUM(FRAU.NUMBER_OF_FILES) NUMBER_OF_FILES
  1268. FROM V$FLASH_RECOVERY_AREA_USAGE FRAU, V$RECOVERY_FILE_DEST RFD
  1269. GROUP BY ROLLUP(FILE_TYPE);
  1270. --EXPIRED可以理解为失效的备份集,即物理文件丢失。OBSOLETE可以理解为过期的备份集。
  1271. CROSSCHECK ARCHIVELOG ALL;
  1272. LIST EXPIRED ARCHIVELOG ALL;
  1273. DELETE EXPIRED ARCHIVELOG ALL;
  1274. --错误记录
  1275. v_error := SQLCODE || ',' || SQLERRM || chr(13) ||dbms_utility.format_error_backtrace;
  1276. --DML行数
  1277. v_count :=TO_CHAR(SQL%ROWCOUNT);
  1278. -----------块改变跟踪
  1279. alter system set db_create_file_dest = '/u01/bct/' scope=both sid='*';
  1280. alter database enable block change tracking;
  1281. ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '+FRA';
  1282. ALTER DATABASE ENABLE BLOCK CHANGE TRACKING USING FILE '/mydir/rman_change_track.f' REUSE;
  1283. ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
  1284. COL STATUS FORMAT A8
  1285. COL FILENAME FORMAT A60
  1286. SELECT STATUS, FILENAME,BYTES FROM V$BLOCK_CHANGE_TRACKING;
  1287. SELECT file#,
  1288. AVG(datafile_blocks),
  1289. AVG(blocks_read),
  1290. AVG(blocks_read / datafile_blocks) * 100 AS PCT_READ_FOR_BACKUP,
  1291. AVG(blocks)
  1292. FROM v$backup_datafile
  1293. WHERE used_change_tracking = 'YES'
  1294. AND incremental_level > 0
  1295. GROUP BY file#;
  1296. -------------------------------------------------------------- 联机重做日志
  1297. ----------清除未归档日志
  1298. ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP 2;
  1299. ----------清空损坏的日志文件 成功执行前提:一致性关闭,解决ora-00392错误
  1300. ALTER DATABASE CLEAR LOGFILE GROUP 2;
  1301. ----- 添加 redo
  1302. alter database add logfile group 4 'c:\oracle\oradata\orcl\redo04.log' size 100m;
  1303. alter database add logfile;
  1304. alter database add logfile [group n];
  1305. alter database add logfile member '<dir>' to group [n] /*add logfile member这个方法仅使用未使用OMF的日志文件,对于已经运用了OMF的日志组,无法使用该功能添加日志文件*/
  1306. alter database add logfile thread 1 group 4 ('+DATA','+FRA') size 50M;
  1307. --alter database add standby logfile thread 1 group 5 ('+DATA','+FRA') size 50M ;
  1308. ---rac库可以在同一个实例下添加
  1309. alter database add logfile thread 1 group 7('+DATA_DG/querydb/redo07_1.log','+DATA_DG/querydb/redo07_2.log') size 1024m;
  1310. alter database add logfile thread 2 group 8('+DATA_DG/querydb/redo08_1.log','+DATA_DG/querydb/redo08_2.log') size 1024m;
  1311. --- 删除
  1312. alter database drop logfile group 4;
  1313. alter database drop logfile member '';
  1314. --------重命名redo
  1315. SQL> ho cp /u03/app/oracle/oradata/ora1024g/redo03.log /u03/app/oracle/oradata/ora1024g/redo04.log
  1316. SQL> alter database rename file '/u03/app/oracle/oradata/ora1024g/redo03.log' to '/u03/app/oracle/oradata/ora1024g/redo04.log';
  1317. --------重命名 表空间 重命名表空间
  1318. alter tablespace users rename to users01;
  1319. ----------------- 一个查询慢的sql例子
  1320. select count(1) from dba_objects a
  1321. inner join user_objects b on 1=1
  1322. inner join user_objects c on 1=1
  1323. ;
  1324. ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 构造大表
  1325. select level,level from dual connect by level<=1000;
  1326. CREATE TABLE T_YH_20170705_LHR NOLOGGING
  1327. AS
  1328. SELECT 137 || (LPAD(ROWNUM, 8,'0')) x
  1329. FROM DUAL
  1330. CONNECT BY LEVEL <= 99999999;
  1331. DROP TABLE T_YH_20170705_LHR;
  1332. CREATE TABLE T_YH_20170705_LHR NOLOGGING AS
  1333. SELECT 137 || (LPAD(ROWNUM, 8,'0')) x
  1334. from xmltable('1 to 99999999');
  1335. -----------外部表
  1336. CREATE DIRECTORY EXT_LOG AS '/tmp';
  1337. DROP TABLE ALERT_LOG_lhr2;
  1338. CREATE TABLE ALERT_LOG_lhr2(
  1339. TEXT VARCHAR2(4000)
  1340. )ORGANIZATION EXTERNAL
  1341. (TYPE ORACLE_LOADER
  1342. DEFAULT DIRECTORY EXT_LOG
  1343. ACCESS PARAMETERS
  1344. (RECORDS DELIMITED BY NEWLINE CHARACTERSET utf8
  1345. nobadfile
  1346. nodiscardfile
  1347. nologfile
  1348. FIELDS TERMINATED BY 0X'0D' LDRTRIM
  1349. REJECT ROWS WITH ALL NULL FIELDS
  1350. )LOCATION('lhr1.txt')
  1351. ) reject limit unlimited ;
  1352. ----------文件格式
  1353. df -hT
  1354. --------------ORA-00845: MEMORY_TARGET not supported on this system
  1355. 办法: 修改/etc/fstab
  1356. tmpfs /dev/shm tmpfs defaults,size=4G 0 0
  1357. [root@FWDB ~]# mount -o remount,size=4G /dev/shm
  1358. 简单来说就是 MEMORY_MAX_TARGET 的设置不能超过 /dev/shm 的大小:
  1359. [oracle@FWDB FWDB]$ df -h | grep shm
  1360. tmpfs 2.0G 0 2.0G 0% /dev/shm
  1361. 马上把它加大:
  1362. [root@FWDB ~]# cat /etc/fstab | grep tmpfs
  1363. tmpfs /dev/shm tmpfs defaults,size=4G 0 0
  1364. 现在可以通过重启使这个配置生效,也可以通过重新挂载来修改其大小:
  1365. [root@FWDB ~]# mount -o remount,size=4G /dev/shm
  1366. [root@FWDB ~]# df -h | grep shm
  1367. tmpfs 4.0G 0 4.0G 0% /dev/shm
  1368. 再次启动数据库,没有报错了。
  1369. 二、修改/dev/shm大小
  1370. 默认的最大一半内存大小在某些场合可能不够用,并且默认的inode数量很低一般都要调高些,这时可以用mount命令来管理它。
  1371. #mount -o size=1500M -o nr_inodes=1000000 -o noatime,nodiratime -o remount /dev/shm
  1372. 2G的机器上,将最大容量调到1.5G,并且inode数量调到1000000,这意味着大致可存入最多一百万个小文件。
  1373. 如果需要永久修改/dev/shm的值,需要修改/etc/fstab
  1374. tmpfs /dev/shm tmpfs defaults,size=1.5G 0 0
  1375. mount -o remount /dev/shm
  1376. umount tmpfs
  1377. mount -t tmpfs shmfs -o size=3000m /dev/shm
  1378. vi /etc/fstab
  1379. 若有的时候不能卸载该目录,报错:“umount: /dev/shm: device is busy.”,则可以用fuser处理:
  1380. # fuser -km /dev/shm
  1381. # umount /dev/shm
  1382. # mount /dev/shm
  1383. ---red hat重启网卡
  1384. service network restart
  1385. /etc/rc.d/init.d/network restart
  1386. ---suse重启网卡
  1387. service network restart
  1388. rcnetwork restart
  1389. /etc/rc.d/init.d/network restart
  1390. ----卸载网卡
  1391. ifconfig eth0 down
  1392. --- 单独重启网卡
  1393. ifdown eth0 && ifup eth0
  1394. ifconfig eth0 down && ifconfig eth0 up
  1395. ----------------------------------------------- 固定IP 配置静态ip地址
  1396. ifconfig eth1 192.168.210.108 broadcast 192.168.210.254 netmask 255.255.255.0
  1397. ifconfig eth1 192.168.59.130 broadcast 192.168.59.1 netmask 255.255.255.0
  1398. ifconfig eth0 192.168.59.130 netmask 255.255.255.0 gw 192.168.129.1
  1399. chkconfig NetworkManager off
  1400. chkconfig network on
  1401. service NetworkManager stop
  1402. service network start
  1403. ---若还有问题,可删掉网卡重新添加
  1404. vi /etc/sysconfig/network-scripts/ifcfg-eth0
  1405. vi /etc/udev/rules.d/70-persistent-net.rules
  1406. DEVICE=eth0
  1407. IPADDR=192.168.59.130
  1408. NETMASK=255.255.255.0
  1409. NETWORK=192.168.59.0
  1410. BROADCAST=192.168.59.255
  1411. GATEWAY=192.168.59.2
  1412. ONBOOT=yes
  1413. USERCTL=no
  1414. BOOTPROTO=static
  1415. #HWADDR=00:0c:29:97:f1:5b
  1416. TYPE=Ethernet
  1417. IPV6INIT=no
  1418. DNS1=202.96.209.5
  1419. DNS2=8.8.8.8
  1420. NAME="System eth0"
  1421. ----------------- 动态ip地址
  1422. DEVICE=eth0
  1423. ONBOOT=yes
  1424. USERCTL=no
  1425. BOOTPROTO=dhcp
  1426. HWADDR=00:0c:29:97:f1:5b
  1427. TYPE=Ethernet
  1428. PEERDNS=yes
  1429. IPV6INIT=no
  1430. [root@rhel6 ~]# export LANG=C
  1431. [root@rhel6 ~]# setup
  1432. [root@rhel6 ~]#
  1433. ------------------------------------------------- 修改主机名
  1434. 永久生效:
  1435. [root@zijuan /]# vim /etc/sysconfig/network
  1436. NETWORKING=yes
  1437. NETWORKING_IPV6=yes
  1438. HOSTNAME=zijuan
  1439. HOSTNAME=zijuan表示主机设置为zijuan.
  1440. 注意:修改主机名后,需要重启系统后生效,或者切换个用户然后切换回来就OK
  1441. 查看/etc/hosts文件中必须包含a fully qualified name for the server
  1442.  [root@localhost lhr]# cat /etc/hosts
  1443. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  1444. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  1445. 192.168.59.140 dg
  1446. [root@localhost lhr]# hostname
  1447. localhost.localdomain
  1448. [root@localhost lhr]# hostname dg
  1449. [root@localhost lhr]# hostname
  1450. dg
  1451. -----归档格式
  1452. alter system set log_archive_format = "log_oradg10g_%d_%t_%s_%r.arc" scope=spfile;
  1453. ---------------------------------------- drop database 删除数据库
  1454. 1、dbca静默删库:dbca -silent -deleteDatabase -sourceDB mydb
  1455. 2SQL窗口:
  1456. alter database close;
  1457. alter system enable restricted session;
  1458. drop database;
  1459. 3SQL窗口:
  1460. sql > startup force mount restrict;
  1461. sql > drop database;
  1462. 注意:强烈推荐第一种办法,以上23的办法若是rac库需要设置cluster_database为false后才可以执行drop database,命令为:alter system set cluster_database=false sid='*' scope=spfile;
  1463. -------------------------------------- 配置本地yum源
  1464. -----------rhel 6.5
  1465. mkdir -p /media/lhr/cdrom
  1466. mount /dev/sr0 /media/lhr/cdrom/
  1467. #设置开机自动挂载系统镜像文件 vi /etc/fstab 添加以下内容
  1468. /dev/sr0 /media/lhr/cdrom iso9660 defaults,ro,loop 0 0
  1469. cd /etc/yum.repos.d/
  1470. cp rhel-media.repo rhel-media.repo.bk
  1471. vi /etc/yum.repos.d/rhel-media.repo
  1472. [rhel-media]
  1473. name=Red Hat Enterprise Linux 6.5
  1474. baseurl=file:///media/lhr/cdrom
  1475. enabled=1
  1476. gpgcheck=1
  1477. gpgkey=file:///media/lhr/cdrom/RPM-GPG-KEY-redhat-release
  1478. yum install httpd  #安装命令
  1479. yum install -y *sz*
  1480. rpm -ivh lrzsz-0.12.20-27.1.el6.x86_64.rpm
  1481. yum -y remove mysql-libs-5.1.71 --卸载
  1482. yum erase mysql-libs-5.1.71 --卸载
  1483. yum list | grep mysql
  1484. rpm -e --nodeps mysql-libs.x86_64 --强制卸载
  1485. -----------------命令后rpm包被下载到了什么地方
  1486. 每次在执行完yum命令后,系统都会把需要用到的rpm包放在/var/cache/yum/这个目录下,但下载源的不同还是会放在不同源目录下。
  1487. find /var/cache/yum/ -name kmod-oracleasm*
  1488. --extundelete工具恢复rm -rf 删除的目录(ext4)
  1489. -------------- rhel5.5
  1490. # mkdir /media/cdromlhr
  1491. 编辑 /etc/fstab 文件,在文件尾部添加如下内容,以便开机自动挂载光盘:
  1492. [root@localhost ~]# tail -1 /etc/fstab
  1493. /dev/hdc /media/cdromlhr iso9660 defaults 0 0
  1494. [root@localhost ~]#
  1495. [root@localhost ~]# mount -a
  1496. mount: block device /dev/sr0 is write-protected, mounting read-only
  1497. [root@localhost ~]#
  1498. 清空并编辑 YUM 源配置文件
  1499. 清空 /etc/yum.repos.d/rhel-debuginfo.repo 文件并新增以下内容:
  1500. [root@localhost ~]# cp /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
  1501. [root@localhost ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo
  1502. [rhel-debuginfo]
  1503. name=Red Hat Enterprise Linux $releasever - $basearch - Debug
  1504. baseurl=file:///media/cdromlhr/Server
  1505. enabled=1
  1506. gpgcheck=0
  1507. # vi /etc/yum.repos.d/my.repo
  1508. [Oracle]
  1509. name=OEL-$releasever – Media
  1510. baseurl=file:///mnt/Server
  1511. gpgcheck=0
  1512. enabled=1
  1513. 如果是RHEL或者CentOS,请先将/etc/yum.repos.d下面的文件删除或者移动到别的目录下,RHEL创建方法和OEL一样,CentOS则baseurl=file:///mnt/ 即可,因为CentOS的repodata目录就在光盘根下。
  1514. ------查看资源的属性值:
  1515. [root@rac2 ~]# crsctl stat res ora.cluster_interconnect.haip -p -init | grep ENABLED
  1516. ENABLED=0
  1517. [root@rac2 ~]# crsctl stat res ora.asm -p -init | grep START_DEPENDENCIES
  1518. START_DEPENDENCIES=hard(ora.cssd,ora.ctssd)pullup(ora.cssd,ora.ctssd)weak(ora.drivers.acfs)
  1519. [root@rac2 ~]#
  1520. ---修改资源的属性值
  1521. crsctl modify resource ora.<diskgroup>.dg -attr AUTO_START=always
  1522. --数据库开机启动
  1523. crsctl modify resource ora.rac18c.db -attr AUTO_START=never -unsupported
  1524. ---启动磁盘组
  1525. srvctl start diskgroup -g data -n "rac2"
  1526. ------------- 添加rac数据库到集群
  1527. srvctl add database -d DGPHY -c RAC -o /oracle/app/oracle/product/11.2.0/db -p '+DATA/TESTDGPHY/PARAMETERFILE/spfiledgphy.ora' -r physical_standby -n TESTDG
  1528. srvctl add instance -d DGPHY -i DGPHY1 -n ZFZHLHRDB1
  1529. srvctl add instance -d DGPHY -i DGPHY2 -n ZFZHLHRDB2
  1530. srvctl status database -d DGPHY
  1531. srvctl start database -d TESTDG
  1532. srvctl remove database -d DGPHY
  1533. --添加监听到crs 必须是grid添加
  1534. [ZFZHLHRDB3:grid]:/home/grid>srvctl add listener -l LISTENER_LHRDG -p 1523 -o $ORACLE_HOME
  1535. srvctl config listener -l LISTENER_LHRDG -a
  1536. ① rac添加LISTENER资源的时候需要使用grid用户
  1537. ② srvctl config查看资源的具体配置情况
  1538. ③ srvctl modify可以修改资源的配置
  1539. --添加单实例
  1540. srvctl add database -d LHRDGPRI -c SINGLE -o /oracle/app/oracle/product/11.2.0/db -p '/oracle/app/oracle/product/11.2.0/db/dbs/spfileLHRDGPHY1.ora' -r physical_standby -n LHRDGPRI -x ZFZHLHRDB1 -i LHRDGPRI
  1541. crsctl status resource ora.asm -f
  1542. crsctl modify resource ora.asm -attr "GEN_USR_ORA_INST_NAME@SERVERNAME(zfxdeskdb1)=+ASM1"
  1543. crsctl modify resource ora.asm -attr "GEN_USR_ORA_INST_NAME@SERVERNAME(zfxdeskdb2)=+ASM2"
  1544. srvctl stop asm -f
  1545. -------------- 11g rac 修改归档 alter system set log_archive_dest_1='LOCATION=/arch/DGPHY' scope=spfile sid='*'; 
  1546. SQL>alter system set log_archive_dest_1='LOCATION=+FRA/GUITAR/ARC1' scope=spfile sid='guitar1'
  1547. Diskgroup altered.  
  1548.   
  1549. SQL>alter system set log_archive_dest_1='LOCATION=+FRA/GUITAR/ARC2' scope=spfile sid='guitar2'
  1550. Diskgroup altered.  
  1551.   
  1552. 干净关闭数据库然后启动库到mount,在其中一个实例上执行alter database archivelog 然后打开数据库即可。
  1553. [root@node1 ~]# srvctl stop database -d jmrac -o immediate
  1554. [root@node1 ~]# srvctl start database -d jmrac -o mount
  1555. ------------------ mgmtdb
  1556. srvctl stop mgmtdb
  1557. srvctl status mgmtdb
  1558. srvctl config mgmtdb
  1559. srvctl disable mgmtdb
  1560. srvctl disable mgmtlsnr
  1561. srvctl add mgmtdb
  1562. srvctl config mgmtdb
  1563. srvctl disable mgmtdb
  1564. srvctl enable mgmtdb
  1565. srvctl getenv mgmtdb
  1566. srvctl modify mgmtdb
  1567. srvctl relocate mgmtdb
  1568. srvctl remove mgmtdb
  1569. srvctl setenv mgmtdb
  1570. srvctl start mgmtdb
  1571. srvctl status mgmtdb
  1572. srvctl stop mgmtdb
  1573. srvctl unsetenv mgmtdb
  1574. srvctl add mgmtlsnr
  1575. srvctl config mgmtlsnr
  1576. srvctl disable mgmtlsnr
  1577. srvctl enable mgmtlsnr
  1578. srvctl getenv mgmtlsnr
  1579. srvctl modify mgmtlsnr
  1580. srvctl remove mgmtlsnr
  1581. srvctl setenv mgmtlsnr
  1582. srvctl start mgmtlsnr
  1583. srvctl status mgmtlsnr
  1584. srvctl stop mgmtlsnr
  1585. srvctl unsetenv mgmtlsnr
  1586. [grid@raclhr-12cR1-N1 ~]$ export ORACLE_SID=-MGMTDB
  1587. [grid@raclhr-12cR1-N1 ~]$ sqlplus / as sysdba
  1588. Database unique name: _mgmtdb
  1589. Database name: _mgmtdb
  1590. Oracle user: grid
  1591. Database instance: -MGMTDB
  1592. service_names:_mgmtdb
  1593. ------------------------------- export display
  1594. export DISPLAY=192.168.59.1:0.0
  1595. xhost +
  1596. 在linux系统中用Oracle帐号执行DBCA或其他JAVA图形界面程序时,报错:
  1597. Xlib: connection to ":0.0" refused by server
  1598. Xlib: No protocol specified
  1599. Error: Can't open display: :0.0
  1600. 解决办法:用root登陆,在#提示符后输入:
  1601. xhost local:oracle
  1602. -----------------------------iSCSI target
  1603. more /etc/ietd.conf --配置文件
  1604. service iscsi-target start #启动iSCSI target
  1605. cat /proc/net/iet/volume #查看iSCSI-target共享出的硬盘
  1606. cat /proc/net/iet/session #查看客户端(initiator端)登陆到target的情况
  1607. -----------------------------iSCSI initiator
  1608. more /etc/iscsi/initiatorname.iscsi
  1609. more /etc/iscsi/iscsid.conf
  1610. iscsiadm -m discovery -t sendtargets -p 192.168.59.200:3260
  1611. iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.5e423e1e4d90 -p 192.168.59.200:3260 -l
  1612. iscsiadm --mode discovery --type sendtargets --portal 192.168.59.200
  1613. iscsiadm --mode node --targetname iqn.2006-01.com.openfiler:tsn.5e423e1e4d90 –portal 192.168.59.200:3260 --login
  1614. iscsiadm -m session -P 3
  1615. service iscsi start #启动iSCSI initiator
  1616. /etc/init.d/iscsi start
  1617. service iscsi start
  1618. service iscsid start
  1619. chkconfig iscsi on
  1620. chkconfig iscsid on
  1621. chkconfig --level 2345 iscsi on
  1622. chkconfig --list|grep iscsi
  1623. -------------------------- 多路径常用命令
  1624. rpm -ivh device-mapper-multipath-libs-0.4.9-72.el6.x86_64.rpm
  1625. rpm -ivh device-mapper-multipath-0.4.9-72.el6.x86_64.rpm
  1626. [root@raclhr-12cR1-N1 Packages]# rpm -qa|grep device-mapper
  1627. device-mapper-multipath-0.4.9-72.el6.x86_64
  1628. device-mapper-persistent-data-0.2.8-2.el6.x86_64
  1629. device-mapper-1.02.79-8.el6.x86_64
  1630. device-mapper-event-libs-1.02.79-8.el6.x86_64
  1631. device-mapper-event-1.02.79-8.el6.x86_64
  1632. device-mapper-multipath-libs-0.4.9-72.el6.x86_64
  1633. device-mapper-libs-1.02.79-8.el6.x86_64
  1634. rpm -qa|grep multipath
  1635. modprobe dm-multipath
  1636. modprobe dm-round-robin
  1637. lsmod |grep multipath
  1638. chkconfig --level 2345 multipathd on
  1639. chkconfig --list|grep multipathd
  1640. chkconfig --list multipathd
  1641. /sbin/mpathconf
  1642. service multipathd restart
  1643. #/etc/init.d/multipathd restart
  1644. ps -ef|grep multipathd
  1645. /sbin/mpathconf --enable --find_multipaths y --with_module y --with_chkconfig y
  1646. ll /etc/multipath.conf
  1647. multipath -F
  1648. multipath -v2
  1649. more /etc/multipath/wwids
  1650. multipath -ll
  1651. dmsetup ls|sort
  1652. ll /dev/dm-*
  1653. multipath -v3 -ll
  1654. multipathd -k
  1655. service multipathd reload
  1656. ---------------获取wwid SCSI ID
  1657. --/etc/udev/rules.d/99-oracle-asmdevices.rules
  1658. --在RHEL 6中,可以通过如下方式获取磁盘wwid:
  1659. for i in `cat /proc/partitions | awk {'print $4'} |grep sd`; do echo "### $i: `scsi_id --whitelist /dev/$i`"; done
  1660. -- 在RHEL 5中,可以通过如下方式获取磁盘wwid:
  1661. for i in `cat /proc/partitions | awk {'print $4'} |grep sd`; do echo "### $i: `scsi_id -g -u -s /block/$i`"; done
  1662. --配置udev规则,脚本如下所示:
  1663. for i in f g h i j k l m ;
  1664. do
  1665. echo "KERNEL==\"dm-*\", BUS==\"block\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\",NAME=\"asm-disk$i\",OWNER=\"grid\",GROUP=\"asmadmin\",MODE=\"0660\"" >> /etc/udev/rules.d/99-oracleasm.rules
  1666. done
  1667. 编辑/etc/multipath.conf
  1668. for i in f g h i j k l m ;
  1669. do
  1670. echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --device=/dev/\$name\",RESULT==\"`scsi_id --whitelisted --device=/dev/sd$i`\",NAME=\"asm-disk$i\",OWNER=\"grid\",GROUP=\"asmadmin\",MODE=\"0660\""
  1671. done
  1672. ---------------------------------再次重新加载UDEV规则
  1673. --- # 业务运行期间,禁止通过执行/sbin/start_udev使规则生效!
  1674. /sbin/udevadm control --reload-rules
  1675. /sbin/udevadm trigger --type=devices --action=change
  1676. --在线添加ASM盘
  1677. udevadm trigger --subsystem-match=block --action=add
  1678. udevadm control --reload-rules && udevadm trigger
  1679. alter diskgroup DATA add disk '/dev/rhdiskpower38' rebalance power 10;
  1680. alter diskgroup DATA rebalance power 11;
  1681. col ERROR_CODE for a20
  1682. select * from v$asm_operation;
  1683. -------------------------------------------------------------- ASM
  1684. ---------------------------- oracleasm常用命令 asmlib oracleasm日志: tail -f /var/log/oracleasm
  1685. /usr/sbin/oracleasm configure -i
  1686. /usr/sbin/oracleasm createdisk DISK1 /dev/sdb1
  1687. /etc/init.d/oracleasm scandisks
  1688. /etc/init.d/oracleasm listdisks
  1689. /etc/init.d/oracleasm enable
  1690. /etc/init.d/oracleasm restart
  1691. /usr/sbin/oracleasm enable
  1692. /usr/sbin/oracleasm restart
  1693. /usr/sbin/oracleasm createdisk DISKNAME devicename
  1694. /usr/sbin/oracleasm deletedisk DISKNAME
  1695. /usr/sbin/oracleasm querydisk {DISKNAME | devicename}
  1696. /usr/sbin/oracleasm listdisks
  1697. /usr/sbin/oracleasm scandisks
  1698. ls -l /dev/oracleasm/disks
  1699. --配置文件
  1700. cat /etc/sysconfig/oracleasm
  1701. ------ ASM磁盘
  1702. $ORACLE_HOME/bin/kfod disk=asm s=true ds=true c=true
  1703. /grid/stage/ext/bin/kfod disk=asm s=true ds=true c=true
  1704. # 18c
  1705. kfod disks=asm ds=true cluster=true
  1706. create diskgroup DATA external redundancy disk '/dev/raw/raw*';
  1707. create diskgroup FRA external redundancy disk '/dev/rhdisk3'; --创建磁盘组FRA
  1708. CREATE DISKGROUP ACFSDG external redundancy DISK '/dev/oracleasm/disks/VOL1' ATTRIBUTE 'compatible.asm' = '11.2','compatible.rdbms' = '11.2','compatible.advm'='11.2';
  1709. create diskgroup OCR external redundancy disk 'ORCL:OVDISK' attribute 'compatible.asm'='11.2','compatible.rdbms'='11.2';
  1710. CREATE DISKGROUP dgroup1 NORMAL REDUNDANCY disk '/dev/raw/raw6', '/dev/raw/raw7';
  1711. CREATE DISKGROUP dgroup1 HIGH REDUNDANCY disk '/dev/raw/raw6', '/dev/raw/raw7', '/dev/raw/raw8';
  1712. create diskgroup DG1 external redundancy
  1713. failgroup FG1 disk '/dev/raw/raw6' name DG2_FG1_VOL1
  1714. failgroup FG2 disk '/dev/raw/raw7' name DG2_FG2_VOL2;
  1715. create diskgroup DG2 normal redundancy
  1716. failgroup FG1 disk '/dev/raw/raw6' name DG2_FG1_VOL1
  1717. failgroup FG2 disk '/dev/raw/raw7' name DG2_FG2_VOL2;
  1718. create diskgroup DG2 normal redundancy
  1719. failgroup FG1 disk '/dev/raw/raw6','/dev/raw/raw7' name DG2_FG1_VOL1
  1720. failgroup FG2 disk '/dev/raw/raw8','/dev/raw/raw9' name DG2_FG2_VOL2;
  1721. ---修改磁盘组的兼容属性
  1722. ALTER DISKGROUP asm_dg SET ATTRIBUTE 'compatible.asm' = '11.1';
  1723. ALTER DISKGROUP asm_dg SET ATTRIBUTE 'compatible.rdbms' = '11.1';
  1724. COLUMN name FORMAT A10
  1725. COLUMN compatibility FORMAT A20
  1726. COLUMN database_compatibility FORMAT A20
  1727. SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup;
  1728. set line 9999
  1729. set pagesize 9999
  1730. col path format a60
  1731. SELECT a.group_number, disk_number,mount_status, a.name, path FROM v$asm_disk a order by a.disk_number;
  1732. select instance_name,status from v$instance;
  1733. set line 999
  1734. select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number, disk_number,mount_status, path from v$asm_diskgroup a;
  1735. select a.group_number,name,TYPE,state,TOTAL_MB,free_mb from v$asm_diskgroup a;
  1736. select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number from v$asm_diskgroup a;
  1737. alter diskgroup DG1 mount;
  1738. ---nomount状态下强制删除磁盘组
  1739. drop diskgroup oradg force including contents;
  1740. alter diskgroup DG1 drop disk DG1_VOL5; --删除磁盘组DG1中的磁盘VOL5
  1741. alter system set asm_diskstring='','ORCL:*','/dev/raw/raw*','/dev/oracleasm/disks/VOL*';
  1742. alter system set asm_diskstring='/dev/asm-disk*','/dev/raw/raw*';
  1743. alter diskgroup DATA add disk '/dev/raw/raw1';
  1744. ------------------------ faking asmdisk asm磁盘
  1745. ---- 添加loop设备个数
  1746. 第一种办法:修改 /etc/modprobe.conf 文件添加参数:options loop max_loop=20 可以通过 modprobe -v loop 命令立即加载该模块,或重启
  1747. 第二种办法(通用):mknod -m 0660 /dev/loopX b 7 X
  1748. raw -qa
  1749. losetup -a
  1750. --mknod -m 0660 /dev/loopX b 7 X
  1751. mknod -m 0660 /dev/loop9 b 7 9
  1752. mkdir /asmdisk
  1753. dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000
  1754. dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000
  1755. dd if=/dev/zero of=/asmdisk/disk3 bs=1024k count=2000
  1756. dd if=/dev/zero of=/asmdisk/disk4 bs=1024k count=2000
  1757. dd if=/dev/zero of=/asmdisk/disk5 bs=1024k count=2000
  1758. /sbin/losetup /dev/loop1 /asmdisk/disk1
  1759. /sbin/losetup /dev/loop2 /asmdisk/disk2
  1760. /sbin/losetup /dev/loop3 /asmdisk/disk3
  1761. /sbin/losetup /dev/loop4 /asmdisk/disk4
  1762. /sbin/losetup /dev/loop5 /asmdisk/disk5
  1763. raw /dev/raw/raw1 /dev/loop1
  1764. raw /dev/raw/raw2 /dev/loop2
  1765. raw /dev/raw/raw3 /dev/loop3
  1766. raw /dev/raw/raw4 /dev/loop4
  1767. raw /dev/raw/raw5 /dev/loop5
  1768. chmod 660 /dev/raw/raw1
  1769. chmod 660 /dev/raw/raw2
  1770. chmod 660 /dev/raw/raw3
  1771. chmod 660 /dev/raw/raw4
  1772. chmod 660 /dev/raw/raw5
  1773. chown oracle:dba /dev/raw/raw1
  1774. chown oracle:dba /dev/raw/raw2
  1775. chown oracle:dba /dev/raw/raw3
  1776. chown oracle:dba /dev/raw/raw4
  1777. chown oracle:dba /dev/raw/raw5
  1778. ------ 将以下内容添加到文件/etc/rc.local文件中
  1779. ------Add the following entries to the file "/etc/rc.local"
  1780. /sbin/losetup /dev/loop1 /asmdisk/disk1
  1781. /sbin/losetup /dev/loop2 /asmdisk/disk2
  1782. /sbin/losetup /dev/loop3 /asmdisk/disk3
  1783. /sbin/losetup /dev/loop4 /asmdisk/disk4
  1784. /sbin/losetup /dev/loop5 /asmdisk/disk5
  1785. raw /dev/raw/raw1 /dev/loop1
  1786. raw /dev/raw/raw2 /dev/loop2
  1787. raw /dev/raw/raw3 /dev/loop3
  1788. raw /dev/raw/raw4 /dev/loop4
  1789. raw /dev/raw/raw5 /dev/loop5
  1790. chmod 660 /dev/raw/raw1
  1791. chmod 660 /dev/raw/raw2
  1792. chmod 660 /dev/raw/raw3
  1793. chmod 660 /dev/raw/raw4
  1794. chmod 660 /dev/raw/raw5
  1795. chown oracle:dba /dev/raw/raw1
  1796. chown oracle:dba /dev/raw/raw2
  1797. chown oracle:dba /dev/raw/raw3
  1798. chown oracle:dba /dev/raw/raw4
  1799. chown oracle:dba /dev/raw/raw5
  1800. ------------------------ Simulating Asm by faking hardware
  1801. -->Faking Hardware
  1802. -->Instaling ASM Lib
  1803. -->Configuring the disks
  1804. -->Install DB & ASM instance
  1805. ---Faking Hardware: root 用户
  1806. mkdir /asmdisk
  1807. dd if=/dev/zero of=/asmdisk/disk1 bs=1024k count=2000
  1808. dd if=/dev/zero of=/asmdisk/disk2 bs=1024k count=2000
  1809. /sbin/losetup /dev/loop1 /asmdisk/disk1
  1810. /sbin/losetup /dev/loop2 /asmdisk/disk2
  1811. raw /dev/raw/raw1 /dev/loop1
  1812. raw /dev/raw/raw2 /dev/loop2
  1813. chmod 660 /dev/raw/raw1
  1814. chmod 660 /dev/raw/raw2
  1815. chown grid:asmadmin /dev/raw/raw1
  1816. chown grid:asmadmin /dev/raw/raw2
  1817. ------Add the following entries to the file "/etc/rc.local"
  1818. echo "/sbin/losetup /dev/loop1 /asmdisk/disk1" >>/etc/rc.local
  1819. echo "/sbin/losetup /dev/loop2 /asmdisk/disk2" >>/etc/rc.local
  1820. --------------------------------- oracle 日志
  1821. oracleasm日志: tail -f /var/log/oracleasm
  1822. oracle agent日志: tail -f /u01/app/11.2.0/grid/log/rhel5/agent/ohasd/oraagent_grid/oraagent_grid.log
  1823. asm 告警日志:alert_log='tail -200f $ORACLE_BASE/diag/asm/+asm/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
  1824. CRS 启动日志: more $ORACLE_HOME/log/$HOSTNAME/crsd/crsd.log
  1825. ------查找:find /u01/app/ -name crsd.log
  1826. crs日志地址:/u01/app/11.2.0/grid/log/rac2/crsd/crsd.log
  1827. oracle 10g 告警日志: /u02/app/oracle/admin/ora10g/bdump
  1828. oracle 11g 告警日志: select value from v$diag_info where name='Default Trace File';
  1829. 在Oracle 12c中,集群的告警日志位置发生了变化,变到了$GRID_HOME/diag/crs中:/u01/app/oracle/diag/crs
  1830. tailf /u01/app/oracle/diag/rdbms/rac18cpri/rac18c1/trace/alert_rac18c1.log
  1831. System Control Statement 系统控制语句 alter system
  1832. ------------------------------------------------------------------------------------------- 恢复到new host
  1833. set pagesize 200 linesize 200
  1834. select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'
  1835. from v$datafile a
  1836. union all
  1837. select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";'
  1838. from v$tempfile a
  1839. union all
  1840. SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || ''''' to ''''' ||
  1841. a.MEMBER || ''''' ";'
  1842. FROM v$logfile a;
  1843. RUN
  1844. {
  1845. # allocate a channel to the tape device
  1846. # ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS '...';
  1847. ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
  1848. # rename the data files and online redo logs
  1849. SET NEWNAME FOR DATAFILE 1 TO '?/oradata/test/system01.dbf';
  1850. SET NEWNAME FOR DATAFILE 2 TO '?/oradata/test/undotbs01.dbf';
  1851. SET NEWNAME FOR DATAFILE 3 TO '?/oradata/test/cwmlite01.dbf';
  1852. SET NEWNAME FOR DATAFILE 4 TO '?/oradata/test/drsys01.dbf';
  1853. SET NEWNAME FOR DATAFILE 5 TO '?/oradata/test/example01.dbf';
  1854. SET NEWNAME FOR DATAFILE 6 TO '?/oradata/test/indx01.dbf';
  1855. SET NEWNAME FOR DATAFILE 7 TO '?/oradata/test/tools01.dbf';
  1856. SET NEWNAME FOR DATAFILE 8 TO '?/oradata/test/users01.dbf';
  1857. SET NEWNAME FOR TEMPFILE 1 TO '?/oradata/test/temp01.dbf';
  1858. SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo01.log''
  1859. TO ''?/oradata/test/redo01.log'' ";
  1860. SQL "ALTER DATABASE RENAME FILE ''/dev3/oracle/dbs/redo02.log''
  1861. TO ''?/oradata/test/redo02.log'' ";
  1862. # Do a SET UNTIL to prevent recovery of the online logs
  1863. SET UNTIL SCN 123456;
  1864. # restore the database and switch the data file names
  1865. RESTORE DATABASE;
  1866. SWITCH DATAFILE ALL;
  1867. SWITCH TEMPFILE ALL;
  1868. # recover the database
  1869. RECOVER DATABASE;
  1870. }
  1871. ------------------------------------------------- 数据库未挂掉的情况下的恢复
  1872. [root@orcltest ~]# ps -ef|grep ora_lgwr_
  1873. .oracle 32173 1 0 06:31 ? 00:00:00 ora_lgwr_oratest
  1874. root 33247 32901 0 10:19 pts/0 00:00:00 grep ora_lgwr_
  1875. [root@orcltest ~]# cd /proc/32173/fd
  1876. [root@orcltest fd]# ll | grep deleted
  1877. lrwx------ 1 root root 64 May 5 15:10 266 -> /u02/app/oracle/oradata/oratest/temp01.dbf (deleted)
  1878. cp 266 /u02/app/oracle/oradata/oratest/temp01.dbf
  1879. ------------------------------------------------------------------------------------------- asm <=> os
  1880. ----所有文件列表 数据文件
  1881. set line 9999 pagesize 9999
  1882. col FILE_NAME format a60
  1883. select 'datafile' file_type, file#,name FILE_NAME,status,enabled from v$datafile
  1884. union all
  1885. select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile
  1886. union all
  1887. select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile
  1888. union all
  1889. select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile
  1890. ;
  1891. set line 9999 pagesize 9999
  1892. col FILE_NAME format a50
  1893. select file#,name FILE_NAME,status,enabled from v$datafile;
  1894. --select file#,name FILE_NAME from v$dbfile;
  1895. col FILE_NAME format a50
  1896. select FILE_NAME,FILE_ID,a.TABLESPACE_NAME, b.status ts_status ,BYTES from dba_data_files a,dba_tablespaces b where a.TABLESPACE_NAME=b.TABLESPACE_NAME;
  1897. -------------------------------------------os--->>asm 互相转换
  1898. -- answer 1 set newname 好
  1899. run{
  1900. crosscheck backup;
  1901. sql 'alter tablespace testdg offline immediate';
  1902. set newname for datafile 14 to'+DATA';
  1903. restore tablespace testdg;
  1904. switch datafile 14;
  1905. recover tablespace testdg;
  1906. sql 'alter tablespace testdg online';
  1907. }
  1908. -- answer 2 convert 好
  1909. rman下:
  1910. convert datafile '/home/oracle/testdg.dbf' format '+DATA';
  1911. sql 下:
  1912. alter tablespace testdg offline ;
  1913. alter tablespace testdg rename datafile '/home/oracle/testdg.dbf' to '+DATA/orclasm/datafile/testdg.284.868895277';
  1914. recover datafile 14;
  1915. alter tablespace testdg online;
  1916. -- answer 3 dbms_file_transfer
  1917. create directory asmsrc as'+DATA/orclasm/datafile/';
  1918. create directory osdesc as '/home/oracle/';
  1919. alter tablespace testdg offline;
  1920. exec dbms_file_transfer.copy_file('osdesc','testdg.dbf','ASMSRC','testdg.dbf');
  1921. alter database rename file '/home/oracle/testdg.dbf' to '+DATA/orclasm/datafile/testdg.dbf';
  1922. alter tablespace testdg online ;
  1923. -- answer 4 backup as copy
  1924. run{
  1925. shutdown immediate;
  1926. startup mount;
  1927. backup as copy datafile 14 format '+DATA';
  1928. }
  1929. SWITCH TABLESPACE testdg TO COPY;
  1930. alter database open;
  1931. -- answer 5 cp
  1932. alter tablespace testdg offline;
  1933. [root@rhel6_lhr ~]# cp /home/oracle/testdg.dbf /home/grid/testdg.dbf
  1934. [root@rhel6_lhr ~]# chown grid:oinstall /home/grid/testdg.dbf
  1935. [root@rhel6_lhr ~]# su - grid
  1936. ASMCMD> cp /home/grid/testdg.dbf +DATA/orclasm/datafile/testdg.dbf
  1937. copying /home/grid/testdg.dbf -> +DATA/orclasm/datafile/testdg.dbf
  1938. ASMCMD>
  1939. alter database rename file '/home/oracle/testdg.dbf' to '+DATA/orclasm/datafile/testdg.dbf';
  1940. alter tablespace testdg online ;
  1941. ------------------------------------------------ asm --->> os
  1942. -- answer 1 好
  1943. rman下:
  1944. convert datafile '+DATA/orclasm/datafile/testdg.277.868887219' format '/home/oracle/testdg.dbf';
  1945. sql 下:
  1946. alter tablespace testdg offline ;
  1947. alter tablespace testdg rename datafile '+DATA/orclasm/datafile/testdg.277.868887219' to '/home/oracle/testdg.dbf';
  1948. recover datafile 14;
  1949. alter tablespace testdg online;
  1950. -- answer 2 dbms_file_transfer
  1951. create directory asmsrc as'+DATA/orclasm/datafile/';
  1952. create directory osdesc as '/home/oracle/';
  1953. alter tablespace testdg offline;
  1954. exec dbms_file_transfer.copy_file('ASMSRC','testdg.282.868891371','osdesc','testdg.dbf');
  1955. alter database rename file'+DATA/orclasm/datafile/testdg.282.868891371' to '/home/oracle/testdg.dbf';
  1956. alter tablespace testdg online ;
  1957. -- answer 3 set newname for datafile
  1958. run{
  1959. shutdown immediate;
  1960. startup mount;
  1961. set newname for datafile 14 to '/home/oracle/testdg.dbf';
  1962. restore datafile 14;
  1963. switch datafile 14;
  1964. recover datafile 14;
  1965. alter database open;
  1966. }
  1967. -- answer 4 switch tablespace
  1968. run{
  1969. shutdown immediate;
  1970. startup mount;
  1971. backup as copy datafile 14 format '/home/oracle/testdg.dbf';
  1972. }
  1973. switch tablespace testdg to copy;
  1974. alter database open;
  1975. -- answer 5 cp
  1976. alter tablespace testdg offline;
  1977. [root@rhel6_lhr ~]# su - grid
  1978. ASMCMD> cp +DATA/orclasm/datafile/testdg.dbf /home/grid/testdg.dbf
  1979. copying +DATA/orclasm/datafile/testdg.dbf -> /home/grid/testdg.dbf
  1980. ASMCMD>
  1981. [root@rhel6_lhr ~]# cp /home/grid/testdg.dbf /home/oracle/testdg.dbf
  1982. [root@rhel6_lhr ~]# chown oracle:oinstall /home/oracle/testdg.dbf
  1983. [root@rhel6_lhr ~]#
  1984. alter database rename file'+DATA/orclasm/datafile/testdg.dbf' to '/home/oracle/testdg.dbf';
  1985. alter tablespace testdg online ;
  1986. ---生成standby controlfile 备库控制文件
  1987. rman:backup device type disk format '/arch/standby_new_lhr_%U.ctl' current controlfile for standby;
  1988. sql:alter database create standby controlfile as '/arch/standby_new_lhr_contol.ctl'
  1989. --------------------控制文件转换
  1990. RMAN> catalog controlfilecopy '/home/oracle/rman_back/ctl_orastrac.ctl_bk';
  1991. cataloged control file copy
  1992. control file copy file name=/home/oracle/rman_back/ctl_orastrac.ctl_bk RECID=7 STAMP=881248289
  1993. RMAN> backup as copy controlfilecopy '/home/oracle/rman_back/ctl_orastrac.ctl_bk' format '+DATA';
  1994. Starting backup at 01-JUN-2015 15:11:44
  1995. using channel ORA_DISK_1
  1996. channel ORA_DISK_1: starting datafile copy
  1997. input control file copy name=/home/oracle/rman_back/ctl_orastrac.ctl_bk
  1998. output file name=+DATA/orastrac/controlfile/backup.331.881248305 tag=TAG20150601T111610 RECID=8 STAMP=881248307
  1999. channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
  2000. Finished backup at 01-JUN-2015 15:11:51
  2001. RMAN-06497: WARNING: control file is not current, control file AUTOBACKUP skipped
  2002. RMAN> restore controlfile to '+DATA' FROM '+DATA/orastrac/controlfile/backup.331.881248305';
  2003. Starting restore at 01-JUN-2015 15:12:49
  2004. using channel ORA_DISK_1
  2005. channel ORA_DISK_1: copied control file copy
  2006. Finished restore at 01-JUN-2015 15:12:50
  2007. create bigfile tablespace ts_dbm datafile '/home/oracle/ts_dbm01.dbf' size 10m autoextend on next 10M ;
  2008. alter user xxx default tablespace bbb;
  2009. ------ smallfile tablespaces
  2010. 单个数据文件的大小由数据库block_size的尺寸决定,例如:
  2011. block_size =8K 对应单个数据文件最大为 32G
  2012. block_size =16K 对应单个据文件最大为 64G
  2013. block_size =32K 对应单个据文件最大为 128G
  2014. ------Bigfile Tablespaces
  2015. block_size =8K 对应单个数据文件最大为 32T
  2016. block_size =16K 对应单个据文件最大为 64T
  2017. block_size =32K 对应单个据文件最大为 128T
  2018. ----如果删除表空间之前删除了表空间文件,解决办法:
  2019. 如果数据库已经启动,则需要先执行下面这行:
  2020. SQL> shutdown abort
  2021. SQL> startup mount
  2022. SQL> alter database datafile 'filename' offline drop;
  2023. SQL> alter database open;
  2024. SQL> drop tablespace tablespace_name including contents;
  2025. alter database datafile '/u02/oracle/oradata/user01.dbf' offline drop;
  2026. alter tablespace test drop datafile '+DATA/orclasm/datafile/test.274.907173619';
  2027. ------表空间默认类型
  2028. SQL> select PROPERTY_NAME,PROPERTY_VALUE from database_properties where PROPERTY_NAME like '%TBS%';
  2029. SQL> alter database set default bigfile tablespace;
  2030. --改回为缺省值
  2031. SQL> alter database set default smallfile tablespace;
  2032. ---控制文件
  2033. --alter system set control_files='/u01/app/oracle/oradata/control01.ctl', '/u01/app/oracle/oradata/control02.ctl','/u01/app/oracle/oradata/control03.ctl' scope=spfile;
  2034. alter database backup controlfile to trace as '/home/oracle/oracle_bk/coolbak/ctl.sql';
  2035. select * from v$controlfile_record_section;
  2036. --转储控制文件
  2037. alter system set events 'immediate trace name controlf level 12';
  2038. ---文件路径
  2039. SELECT d.value || '/' || lower(rtrim(i.instance, chr(0))) || '_ora_' ||
  2040. p.spid || '.trc' trace_file_name
  2041. FROM (SELECT p.spid
  2042. FROM v$mystat m, v$session s, v$process p
  2043. WHERE m.statistic# = '1'
  2044. AND s.sid = m.sid
  2045. AND p.addr = s.paddr) p,
  2046. (SELECT t.instance
  2047. FROM v$thread t, v$parameter v
  2048. WHERE v.name = 'thread'
  2049. AND (v.value = '0' OR to_char(t.thread#) = v.VALUE)) i,
  2050. (SELECT VALUE FROM v$parameter WHERE NAME = 'user_dump_dest') d;
  2051. oradebug setmypid
  2052. SELECT a.SID,
  2053. b.SERIAL# ,
  2054. c.SPID ospid,
  2055. c.pid orapid
  2056. FROM v$mystat a,
  2057. v$session b ,
  2058. v$process c
  2059. WHERE a.SID = b.SID
  2060. and b.PADDR=c.ADDR
  2061. AND rownum = 1;
  2062. oradebug dump controlf 12;
  2063. 16:09:17 SQL> oradebug setmypid
  2064. 已处理的语句
  2065. 16:09:55 SQL> oradebug tracefile_name
  2066. /u01/app/oracle/diag/rdbms/orclasm/orclasm/trace/orclasm_ora_21437.trc
  2067. oradebug event 1555 trace name errorstack level 3
  2068. --唤醒PMON进程
  2069. oradebug wakeup 2
  2070. alter session set events '10246 trace name context forever,level 4';
  2071. alter session set events '10246 trace name context off';
  2072. 热备:
  2073. alter database backup controlfile to '<dir>'; --热备份控制文件 alter database backup controlfile to '/home/oracle/ora_bk/control.bk';
  2074. alter database backup controlfile to trace as '<dir>' ;--得到建立控制文件的脚本
  2075. RMAN:
  2076. backup current controlfile format '/home/oracle/oracle_bk/orclasm/ctl_%d_%T_%s_%p.bak';
  2077. backup database include current controlfile;
  2078. -- 或者设置RMAN 为自动备份
  2079. RMAN > configure controlfile autobackup on;
  2080. ----默认false 忽略一致性检察 隐含参数 隐藏
  2081. SELECT * FROM gv$parameter a WHERE a.NAME like '\_%' escape '\' ;
  2082. SELECT * FROM gv$parameter a WHERE a.NAME like '=_%' escape '=' ;
  2083. recover database using backup controlfile until cancel;
  2084. alter system set "_allow_resetlogs_corruption"=true scope=spfile;
  2085. alter system set "_allow_resetlogs_corruption"=false scope=spfile; --默认
  2086. alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*';
  2087. SQL> show parameter _allow_resetlogs_corruption
  2088. NAME TYPE VALUE
  2089. ------------------------------------ ----------- ------------------------------
  2090. _allow_resetlogs_corruption boolean TRUE
  2091. SET PAGESIZE 9999
  2092. SET LINE 9999
  2093. COL NAME FORMAT A40
  2094. COL KSPPDESC FORMAT A50
  2095. COL KSPPSTVL FORMAT A20
  2096. SELECT A.INDX,
  2097. A.KSPPINM NAME,
  2098. A.KSPPDESC,
  2099. B.KSPPSTVL
  2100. FROM X$KSPPI A,
  2101. X$KSPPCV B
  2102. WHERE A.INDX = B.INDX
  2103. AND LOWER(A.KSPPINM) LIKE LOWER('%&PARAMETER%');
  2104. alter system set "_allow_resetlogs_corruption"=true scope=spfile;
  2105. recover database using backup controlfile until cancel;
  2106. alter database open resetlogs;
  2107. startup force
  2108. alter database open resetlogs;
  2109. alter system set "_allow_resetlogs_corruption"=false scope=spfile;
  2110. alter system reset "_allow_resetlogs_corruption" scope=spfile sid='*';
  2111. ----------------incarnation
  2112. RMAN> list incarnation of database;
  2113. RMAN> reset database to incarnation 8;
  2114. SELECT * FROM V$DATABASE_INCARNATION;
  2115. alter system set log_archive_dest_1='LOCATION=/home/oracle' scope=spfile;
  2116. ---------- 重建控制文件
  2117. CREATE CONTROLFILE REUSE DATABASE "ORA11G" RESETLOGS DATAFILE '/u01/app/oracle/oradata/orcltest/system01.dbf';
  2118. STARTUP NOMOUNT
  2119. CREATE CONTROLFILE REUSE DATABASE "ORA11G" RESETLOGS ARCHIVELOG
  2120. MAXLOGFILES 16
  2121. MAXLOGMEMBERS 3
  2122. MAXDATAFILES 100
  2123. MAXINSTANCES 8
  2124. MAXLOGHISTORY 292
  2125. LOGFILE
  2126. GROUP 1 '/u02/app/oracle/oradata/orcltest/redo01.log' SIZE 50M BLOCKSIZE 512,
  2127. GROUP 2 '/u02/app/oracle/oradata/orcltest/redo02.log' SIZE 50M BLOCKSIZE 512,
  2128. GROUP 3 '/u02/app/oracle/oradata/orcltest/redo03.log' SIZE 50M BLOCKSIZE 512
  2129. -- STANDBY LOGFILE
  2130. DATAFILE
  2131. '/u02/app/oracle/oradata/orcltest/system01.dbf',
  2132. '/u02/app/oracle/oradata/orcltest/sysaux01.dbf',
  2133. '/u02/app/oracle/oradata/orcltest/undotbs01.dbf',
  2134. '/u02/app/oracle/oradata/orcltest/users01.dbf',
  2135. '/u02/app/oracle/oradata/orcltest/example01.dbf'
  2136. CHARACTER SET ZHS16GBK
  2137. ;
  2138. select THREAD#, SEQUENCE#,FIRST_TIME from v$archived_log d where (( THREAD#=2 and SEQUENCE# between 10050 and 10060) or ( THREAD#=1 and SEQUENCE# between 9720 and 9725)) and d.DELETED!='YES' ORDER BY THREAD#, D.RECID;
  2139. run {
  2140. allocate channel c1 type disk;
  2141. allocate channel c2 type disk;
  2142. startup force mount;
  2143. sql 'alter session set NLS_DATE_FORMAT="YYYY-MM-DD HH24:mi:ss"';
  2144. set until time = "to_date('2016-07-28 21:04:50','YYYY-MM-DD HH24:mi:ss')";
  2145. restore database;
  2146. recover database;
  2147. release channel c1;
  2148. release channel c2;
  2149. }
  2150. catalog start with '/u03/backup/' noprompt;
  2151. --restore Controlfile
  2152. DECLARE
  2153. devtype varchar2(256);
  2154. done boolean;
  2155. BEGIN
  2156. devtype:=sys.dbms_backup_restore.deviceAllocate(type=>'',ident=>'T1');
  2157. sys.dbms_backup_restore.restoreSetDatafile;
  2158. sys.dbms_backup_restore.restoreControlfileTo(cfname=>'/tmp/2015_04_30/control01.ctl');
  2159. sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/tmp/2015_04_30/o1_mf_annnn_TAG20150430T160239_bn3rdzd7_.bkp', params=>null);
  2160. sys.dbms_backup_restore.deviceDeallocate;
  2161. END;
  2162. /
  2163. --restore datafile
  2164. DECLARE
  2165. devtype varchar2(256);
  2166. done boolean;
  2167. BEGIN
  2168. devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'t1');
  2169. sys.dbms_backup_restore.restoreSetDatafile;
  2170. sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>01,toname=>'/u02/app/oracle/oradata/orcltest/system01.dbf');
  2171. sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>02,toname=>'/u02/app/oracle/oradata/orcltest/sysaux01.dbf');
  2172. sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>03,toname=>'/u02/app/oracle/oradata/orcltest/undotbs01.dbf');
  2173. sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>04,toname=>'/u02/app/oracle/oradata/orcltest/users01.dbf');
  2174. sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>05,toname=>'/u02/app/oracle/oradata/orcltest/example01.dbf');
  2175. sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'/tmp/2015_05_02/o1_mf_nnndf_TAG20150502T112355_bn8jtcsc_.bkp', params=>null);
  2176. sys.dbms_backup_restore.deviceDeallocate;
  2177. END;
  2178. /
  2179. 注意:
  2180. 在multisection backup 的情况下,我们需要考虑所有的backuppiece(也就是所有的section),使用initmsr函数来restore datafile
  2181. DECLARE
  2182. devtype varchar2(256);
  2183. done boolean;
  2184. BEGIN
  2185. devtype := dbms_backup_restore.DeviceAllocate(type=>null, ident=>'d1');
  2186. dbms_backup_restore.RestoreSetDatafile;
  2187. dbms_backup_restore.initmsr(1,'/ud1001/PROD/oradata/system01-test.dbf');
  2188. dbms_backup_restore.RestoreDatafileTo(dfnumber => 1,toname => '/ud1001/PROD/oradata/system01-test.dbf');
  2189. dbms_backup_restore.RestoreBackupPiece(done => done,handle =>'/backup/Oracle-DB-8-7-2014/db_L0_PROD_e6pf7too_1_1.rman', params => null);
  2190. dbms_backup_restore.RestoreBackupPiece(done => done,handle =>'/backup/Oracle-DB-8-7-2014/db_L0_PROD_e6pf7too_2_1.rman', params => null);
  2191. END;
  2192. /
  2193. --restore archived redolog
  2194. DECLARE
  2195. devtype varchar2(256);
  2196. done boolean;
  2197. BEGIN
  2198. devtype := dbms_backup_restore.DeviceAllocate (type => '',ident => 'FUN');
  2199. dbms_backup_restore.RestoreSetArchivedLog(destination=>'D:\ORACLE_BASE\achive\');
  2200. dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>1);
  2201. dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>2);
  2202. dbms_backup_restore.RestoreArchivedLog(thread=>1,sequence=>3);
  2203. dbms_backup_restore.RestoreBackupPiece(done => done,handle => 'D:\ORACLE_BASE\RMAN_BACKUP\MYDB_LOG_BCK0DH1JGND_1_1', params => null);
  2204. dbms_backup_restore.DeviceDeallocate;
  2205. END;
  2206. /
  2207. --清除控制文件中关于v$archived_log的信息
  2208. SQL> execute sys.dbms_backup_restore.resetCfileSection(11);
  2209. --再次查询v$archived_log,信息已经被清除
  2210. SQL> select dest_id,sequence#,name,blocks from v$archived_log;
  2211. ---------------------------------------------------------------------------------------------------------------- 归档丢失
  2212. SQL> recover database ;
  2213. ORA-00279: change 1549336 generated at 01/15/2015 16:22:07 needed for thread 1
  2214. ORA-00289: suggestion :
  2215. /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_22_865253186.dbf
  2216. ORA-00280: change 1549336 for thread 1 is in sequence #22
  2217. Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
  2218. cancel
  2219. Media recovery cancelled.
  2220. SQL> alter database open;
  2221. alter database open
  2222. *
  2223. ERROR at line 1:
  2224. ORA-01113: file 1 needs media recovery
  2225. ORA-01110: data file 1: '/u01/app/oracle/oradata/utf8test/system01.dbf'
  2226. SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;
  2227. System altered.
  2228. SQL> startup force;
  2229. ORACLE instance started.
  2230. Total System Global Area 1102344192 bytes
  2231. Fixed Size 2227584 bytes
  2232. Variable Size 738198144 bytes
  2233. Database Buffers 352321536 bytes
  2234. Redo Buffers 9596928 bytes
  2235. Database mounted.
  2236. ORA-01113: file 1 needs media recovery
  2237. ORA-01110: data file 1: '/u01/app/oracle/oradata/utf8test/system01.dbf'
  2238. ---- recover database using backup controlfile;
  2239. SQL> recover database until cancel;
  2240. ORA-00279: change 1549336 generated at 01/15/2015 16:22:07 needed for thread 1
  2241. ORA-00289: suggestion :
  2242. /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_22_865253186.dbf
  2243. ORA-00280: change 1549336 for thread 1 is in sequence #22
  2244. Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
  2245. cancel
  2246. ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
  2247. ORA-01194: file 2 needs more recovery to be consistent
  2248. ORA-01110: data file 2: '/u01/app/oracle/oradata/utf8test/sysaux01.dbf'
  2249. ORA-01112: media recovery not started
  2250. SQL> alter database open resetlogs;
  2251. alter database open resetlogs
  2252. *
  2253. ERROR at line 1:
  2254. ORA-00603: ORACLE server session terminated by fatal error
  2255. ORA-00600: internal error code, arguments: [2662], [0], [1549349], [0],
  2256. [1550178], [12583040], [], [], [], [], [], []
  2257. ORA-00600: internal error code, arguments: [2662], [0], [1549348], [0],
  2258. [1550178], [12583040], [], [], [], [], [], []
  2259. ORA-01092: ORACLE instance terminated. Disconnection forced
  2260. ORA-00600: internal error code, arguments: [2662], [0], [1549346], [0],
  2261. [1550178], [12583040], [], [], [], [], [], []
  2262. Process ID: 7693
  2263. Session ID: 237 Serial number: 5
  2264. 退出,重新登录
  2265. SQL> exit
  2266. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  2267. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  2268. [oracle@rhel6_lhr utf8test]$ sqlplus / as sysdba
  2269. SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 16 10:13:53 2015
  2270. Copyright (c) 1982, 2011, Oracle. All rights reserved.
  2271. Connected to an idle instance.
  2272. SQL> startup
  2273. ORACLE instance started.
  2274. Total System Global Area 1102344192 bytes
  2275. Fixed Size 2227584 bytes
  2276. Variable Size 738198144 bytes
  2277. Database Buffers 352321536 bytes
  2278. Redo Buffers 9596928 bytes
  2279. Database mounted.
  2280. Database opened.
  2281. ----------------------------------------------------------------------------------------------------------------
  2282. select * from v$fixed_view_definition a WHERE a.VIEW_NAME like 'X_$DIAG%' ;
  2283. SELECT * FROM V$FIXED_TABLE A WHERE A.NAME like 'X$DIAG%' ;
  2284. ------- 十进制转十六进制
  2285. select to_char(1985432,'xxxxxxxxxxxxxxx') FROM DUAL;
  2286. ------- 十六进制转十进制
  2287. select to_number('1e4b98','xxxxxxxxxxxxxxx') from dual;
  2288. --------------------------- exp和imp grant exp_full_database to lhr;
  2289. Linux: exp scott/tiger tables=emp query=\"where job=\'SALESMAN\' and sal\<1600\"
  2290. Windows exp userid=tkyte/tkyte tables=t query="""where object_id < 5000"""
  2291. 在windows中,需要在WHERE语句的两端使用三个双引号
  2292. --EXP-00091: Exporting questionable statistics 的方法 select userenv('language') from dual; ---->>> NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
  2293. 或加上: STATISTICS=NONE
  2294. ------ query选项
  2295. exp \'/ AS SYSDBA\' tables=test_query_lhr file=/tmp/test_query_lhr_scott.dmp query=\" where owner=\'SCOTT\' \" log=/tmp/test_query_lhr_scott.log
  2296. [ZFZHLHRDB1:oracle]:/oracle>more /tmp/scottfile.par
  2297. query="where owner='SCOTT'"
  2298. [ZFZHLHRDB1:oracle]:/oracle> exp \'/ AS SYSDBA\' tables=test_query_lhr file=/tmp/test_query_lhr_scott_01.dmp parfile=/tmp/scottfile.par log=/tmp/test_query_lhr_scott_01.log
  2299. ------ parfile选项
  2300. [ZFZHLHRDB1:oracle]:/oracle>more /tmp/scottfile.par
  2301. tables=scott.emp,scott.dept
  2302. exp \'/ AS SYSDBA\' file=/tmp/test_query_lhr_scott_01.dmp parfile=/tmp/scottfile.par log=/tmp/test_query_lhr_scott_01.log
  2303. strace exp n1/n1 tables=scott.emp file=a.dmp
  2304. exp cnydm/cnydm@DATAWDB_125 file=d:/oracle_bk/cnydm20150402.dmp log=d:/oracle_bk/cnydm20150402.log buffer=50000000 tables=PRD_CTGRY_D,DSCNT_TP_D,MKT_AND_PRD_CTGRY_D,MKT_CTGRY_D
  2305. imp cnydm/cnydm@DATAWDB_125 file=d:/oracle_bk/cnydm20150402.dmp log=d:/oracle_bk/imp_cnydm20150402.log buffer=50000000 full=y
  2306. exp system/lhr file=E:\expfull.dmp full=y log=E:\expfull.log
  2307. imp system/lhr file=E:\expfull.dmp full=y log=E:\impfull.log
  2308. exp lhr/lhr@orclasm tables=xb_log_lhr,xb_a,xb_b file=e:\e1.dmp log=E:\exp_table.log buffer=41943040
  2309. imp lhr/lhr@winxp tables=xb_log_lhr file=e:\e1.dmp log=E:\exp_table.log buffer=41943040
  2310. imp lhr/lhr@orclasm tables=(emp,dept) file=d:\e1.dmp log=E:\exp_table_.log buffer=41943040
  2311. exp system/lhr file=E:\expfull2.dmp log=E:\expfull2.log owner=(lhrexp,lhrimp)
  2312. imp system/lhr file=E:\expfull2.dmp full=y log=E:\expfull2.log
  2313. imp "sys as sysdba" file=testmv_full.dmp full=y buffer=41943040 feedback=10000 log=testmv_full.log
  2314. imp user2/pwd fromuser=user1 touser=user2 file=/tmp/imp_db_pipe1 feedback=10000 buffer=41943040 log=testmv_full.log
  2315. 生产环境下,oracle 9I下sga大概8G,pga大概6g,需要导入一个2.7g以上的大表到成产库中,由于是同事着手运用imp工具的默认buffer=30K,用时大概一个小时还没有结果,考虑到pga还是很大的,跟同事商议加上buffer=409600000设置buffer大概400M的,15分钟内imp完成。当然运用impdp然后运用parallel=n效率当然更加理想了!
  2316. -------------------------------------------- 导出ASH视图的数据 ash数据
  2317. --- 方法1:ctas建表导出 有的客户不让建表
  2318. CREATE TABLE ASH_TEMP_20161117 NOLOGGING AS
  2319. SELECT *
  2320. FROM DBA_HIST_ACTIVE_SESS_HISTORY D
  2321. WHERE D.SAMPLE_TIME BETWEEN
  2322. TO_DATE('2016-11-10 02:00:00', 'YYYY-MM-DD HH24:MI:SS') AND
  2323. TO_DATE('2016-11-17 06:00:00', 'YYYY-MM-DD HH24:MI:SS')
  2324. ;
  2325. exp \'/ AS SYSDBA\' tables=ASH_TEMP_20161117 file=/tmp/ASH_TEMP_20161117.dmp log=/tmp/ASH_TEMP_20161117.log buffer=41943040
  2326. imp lhr/lhr tables=ASH_TEMP_20161117 file=/tmp/ASH_TEMP_20161117.dmp log=/tmp/imp_ASH_TEMP_20161117.log buffer=41943040
  2327. --- 方法2:导出基表的数据
  2328. ---more /tmp/exp_ash_lhr_01.par
  2329. query="WHERE SAMPLE_TIME BETWEEN TO_DATE('2016-12-02 08:30:00', 'YYYY-MM-DD HH24:MI:SS') AND TO_DATE('2016-12-08 23:38:00', 'YYYY-MM-DD HH24:MI:SS')"
  2330. exp \'/ AS SYSDBA\' tables='WRH$_ACTIVE_SESSION_HISTORY' file=/tmp/exp_ash_lhr_01.dmp parfile=/tmp/exp_ash_lhr_01.par log=/tmp/exp_ash_lhr_01.log GRANTS=N CONSTRAINTS=N STATISTICS=NONE
  2331. exp \'/ AS SYSDBA\' tables='WRM$_SNAPSHOT','WRH$_EVENT_NAME','WRH$_SQLCOMMAND_NAME','WRH$_PLAN_OPERATION_NAME','WRH$_PLAN_OPTION_NAME','WRH$_TOPLEVELCALL_NAME' file=/tmp/exp_ash_lhr_02.dmp log=/tmp/exp_ash_lhr_02.log GRANTS=N CONSTRAINTS=N STATISTICS=NONE
  2332. imp lhr/lhr file=/tmp/exp_ash_lhr_01.dmp tables='WRH$_ACTIVE_SESSION_HISTORY' log=/tmp/imp_ash_lhr_01.log FROMUSER=SYS TOUSER=LHR
  2333. imp lhr/lhr file=/tmp/exp_ash_lhr_02.dmp tables='WRM$_SNAPSHOT','WRH$_EVENT_NAME','WRH$_SQLCOMMAND_NAME','WRH$_PLAN_OPERATION_NAME','WRH$_PLAN_OPTION_NAME','WRH$_TOPLEVELCALL_NAME' log=/tmp/imp_ash_lhr_02.log FROMUSER=SYS TOUSER=LHR
  2334. DROP TABLE LHR.WRH$_ACTIVE_SESSION_HISTORY PURGE;
  2335. DROP TABLE LHR.WRM$_SNAPSHOT PURGE;
  2336. DROP TABLE LHR.WRH$_EVENT_NAME PURGE;
  2337. DROP TABLE LHR.WRH$_SQLCOMMAND_NAME PURGE;
  2338. DROP TABLE LHR.WRH$_PLAN_OPERATION_NAME PURGE;
  2339. DROP TABLE LHR.WRH$_PLAN_OPTION_NAME PURGE;
  2340. DROP TABLE LHR.WRH$_TOPLEVELCALL_NAME PURGE;
  2341. create or replace view dh_ash_11g_lhr
  2342. (snap_id, dbid, instance_number, sample_id, sample_time, session_id, session_serial#, session_type, flags, user_id, sql_id, is_sqlid_current, sql_child_number, sql_opcode, sql_opname, force_matching_signature, top_level_sql_id, top_level_sql_opcode, sql_plan_hash_value, sql_plan_line_id, sql_plan_operation, sql_plan_options, sql_exec_id, sql_exec_start, plsql_entry_object_id, plsql_entry_subprogram_id, plsql_object_id, plsql_subprogram_id, qc_instance_id, qc_session_id, qc_session_serial#, px_flags, event, event_id, seq#, p1text, p1, p2text, p2, p3text, p3, wait_class, wait_class_id, wait_time, session_state, time_waited, blocking_session_status, blocking_session, blocking_session_serial#, blocking_inst_id, blocking_hangchain_info, current_obj#, current_file#, current_block#, current_row#, top_level_call#, top_level_call_name, consumer_group_id, xid, remote_instance#, time_model, in_connection_mgmt, in_parse, in_hard_parse, in_sql_execution, in_plsql_execution, in_plsql_rpc, in_plsql_compilation, in_java_execution, in_bind, in_cursor_close, in_sequence_load, capture_overhead, replay_overhead, is_captured, is_replayed, service_hash, program, module, action, client_id, machine, port, ecid, dbreplay_file_id, dbreplay_call_counter, tm_delta_time, tm_delta_cpu_time, tm_delta_db_time, delta_time, delta_read_io_requests, delta_write_io_requests, delta_read_io_bytes, delta_write_io_bytes, delta_interconnect_io_bytes, pga_allocated, temp_space_allocated)
  2343. as
  2344. select /* ASH/AWR meta attributes */
  2345. ash.snap_id, ash.dbid, ash.instance_number,
  2346. ash.sample_id, ash.sample_time,
  2347. /* Session/User attributes */
  2348. ash.session_id, ash.session_serial#,
  2349. decode(ash.session_type, 1,'FOREGROUND', 'BACKGROUND'),
  2350. ash.flags,
  2351. ash.user_id,
  2352. /* SQL attributes */
  2353. ash.sql_id,
  2354. decode(bitand(ash.flags, power(2, 4)), NULL, 'N', 0, 'N', 'Y'),
  2355. ash.sql_child_number, ash.sql_opcode,
  2356. (select command_name from WRH$_SQLCOMMAND_NAME
  2357. where command_type = ash.sql_opcode
  2358. and dbid = ash.dbid) as sql_opname,
  2359. ash.force_matching_signature,
  2360. decode(ash.top_level_sql_id, NULL, ash.sql_id, ash.top_level_sql_id),
  2361. decode(ash.top_level_sql_id, NULL, ash.sql_opcode,
  2362. ash.top_level_sql_opcode),
  2363. /* SQL Plan/Execution attributes */
  2364. ash.sql_plan_hash_value,
  2365. decode(ash.sql_plan_line_id, 0, to_number(NULL), ash.sql_plan_line_id),
  2366. (select operation_name from WRH$_PLAN_OPERATION_NAME
  2367. where operation_id = ash.sql_plan_operation#
  2368. and dbid = ash.dbid) as sql_plan_operation,
  2369. (select option_name from WRH$_PLAN_OPTION_NAME
  2370. where option_id = ash.sql_plan_options#
  2371. and dbid = ash.dbid) as sql_plan_options,
  2372. decode(ash.sql_exec_id, 0, to_number(NULL), ash.sql_exec_id),
  2373. ash.sql_exec_start,
  2374. /* PL/SQL attributes */
  2375. decode(ash.plsql_entry_object_id,0,to_number(NULL),
  2376. ash.plsql_entry_object_id),
  2377. decode(ash.plsql_entry_object_id,0,to_number(NULL),
  2378. ash.plsql_entry_subprogram_id),
  2379. decode(ash.plsql_object_id,0,to_number(NULL),
  2380. ash.plsql_object_id),
  2381. decode(ash.plsql_object_id,0,to_number(NULL),
  2382. ash.plsql_subprogram_id),
  2383. /* PQ attributes */
  2384. decode(ash.qc_session_id, 0, to_number(NULL), ash.qc_instance_id),
  2385. decode(ash.qc_session_id, 0, to_number(NULL), ash.qc_session_id),
  2386. decode(ash.qc_session_id, 0, to_number(NULL), ash.qc_session_serial#),
  2387. decode(ash.px_flags, 0, to_number(NULL), ash.px_flags),
  2388. /* Wait event attributes */
  2389. decode(ash.wait_time, 0, evt.event_name, NULL),
  2390. decode(ash.wait_time, 0, evt.event_id, NULL),
  2391. ash.seq#,
  2392. evt.parameter1, ash.p1,
  2393. evt.parameter2, ash.p2,
  2394. evt.parameter3, ash.p3,
  2395. decode(ash.wait_time, 0, evt.wait_class, NULL),
  2396. decode(ash.wait_time, 0, evt.wait_class_id, NULL),
  2397. ash.wait_time,
  2398. decode(ash.wait_time, 0, 'WAITING', 'ON CPU'),
  2399. ash.time_waited,
  2400. (case when ash.blocking_session = 4294967295
  2401. then 'UNKNOWN'
  2402. when ash.blocking_session = 4294967294
  2403. then 'GLOBAL'
  2404. when ash.blocking_session = 4294967293
  2405. then 'UNKNOWN'
  2406. when ash.blocking_session = 4294967292
  2407. then 'NO HOLDER'
  2408. when ash.blocking_session = 4294967291
  2409. then 'NOT IN WAIT'
  2410. else 'VALID'
  2411. end),
  2412. (case when ash.blocking_session between 4294967291 and 4294967295
  2413. then to_number(NULL)
  2414. else ash.blocking_session
  2415. end),
  2416. (case when ash.blocking_session between 4294967291 and 4294967295
  2417. then to_number(NULL)
  2418. else ash.blocking_session_serial#
  2419. end),
  2420. (case when ash.blocking_session between 4294967291 and 4294967295
  2421. then to_number(NULL)
  2422. else ash.blocking_inst_id
  2423. end),
  2424. (case when ash.blocking_session between 4294967291 and 4294967295
  2425. then NULL
  2426. else decode(bitand(ash.flags, power(2, 3)), NULL, 'N',
  2427. 0, 'N', 'Y')
  2428. end),
  2429. /* Session's working context */
  2430. ash.current_obj#, ash.current_file#, ash.current_block#,
  2431. ash.current_row#, ash.top_level_call#,
  2432. (select top_level_call_name from WRH$_TOPLEVELCALL_NAME
  2433. where top_level_call# = ash.top_level_call#
  2434. and dbid = ash.dbid) as top_level_call_name,
  2435. decode(ash.consumer_group_id, 0, to_number(NULL),
  2436. ash.consumer_group_id),
  2437. ash.xid,
  2438. decode(ash.remote_instance#, 0, to_number(NULL), ash.remote_instance#),
  2439. ash.time_model,
  2440. decode(bitand(ash.time_model,power(2, 3)),0,'N','Y')
  2441. as in_connection_mgmt,
  2442. decode(bitand(ash.time_model,power(2, 4)),0,'N','Y')as in_parse,
  2443. decode(bitand(ash.time_model,power(2, 7)),0,'N','Y')as in_hard_parse,
  2444. decode(bitand(ash.time_model,power(2,10)),0,'N','Y')as in_sql_execution,
  2445. decode(bitand(ash.time_model,power(2,11)),0,'N','Y')
  2446. as in_plsql_execution,
  2447. decode(bitand(ash.time_model,power(2,12)),0,'N','Y')as in_plsql_rpc,
  2448. decode(bitand(ash.time_model,power(2,13)),0,'N','Y')
  2449. as in_plsql_compilation,
  2450. decode(bitand(ash.time_model,power(2,14)),0,'N','Y')
  2451. as in_java_execution,
  2452. decode(bitand(ash.time_model,power(2,15)),0,'N','Y')as in_bind,
  2453. decode(bitand(ash.time_model,power(2,16)),0,'N','Y')as in_cursor_close,
  2454. decode(bitand(ash.time_model,power(2,17)),0,'N','Y')as in_sequence_load,
  2455. decode(bitand(ash.flags,power(2,5)),NULL,'N',0,'N','Y')
  2456. as capture_overhead,
  2457. decode(bitand(ash.flags,power(2,6)), NULL,'N',0,'N','Y' )
  2458. as replay_overhead,
  2459. decode(bitand(ash.flags,power(2,0)),NULL,'N',0,'N','Y') as is_captured,
  2460. decode(bitand(ash.flags,power(2,2)), NULL,'N',0,'N','Y' )as is_replayed,
  2461. /* Application attributes */
  2462. ash.service_hash, ash.program,
  2463. ash.module module,
  2464. ash.action action,
  2465. ash.client_id,
  2466. ash.machine, ash.port, ash.ecid,
  2467. /* DB Replay info */
  2468. ash.dbreplay_file_id, ash.dbreplay_call_counter,
  2469. /* stash columns */
  2470. ash.tm_delta_time,
  2471. ash.tm_delta_cpu_time,
  2472. ash.tm_delta_db_time,
  2473. ash.delta_time,
  2474. ash.delta_read_io_requests,
  2475. ash.delta_write_io_requests,
  2476. ash.delta_read_io_bytes,
  2477. ash.delta_write_io_bytes,
  2478. ash.delta_interconnect_io_bytes,
  2479. ash.pga_allocated,
  2480. ash.temp_space_allocated
  2481. from WRM$_SNAPSHOT sn, WRH$_ACTIVE_SESSION_HISTORY ash, WRH$_EVENT_NAME evt
  2482. where ash.snap_id = sn.snap_id(+)
  2483. and ash.dbid = sn.dbid(+)
  2484. and ash.instance_number = sn.instance_number(+)
  2485. and ash.dbid = evt.dbid
  2486. and ash.event_id = evt.event_id;
  2487. ----以下数据不能导出
  2488. SELECT * FROM sys.Ku_Noexp_View d WHERE d.name LIKE '%WRH%' ;
  2489. SELECT * FROM DBA_OBJECTS d WHERE d.ORACLE_MAINTAINED='Y' AND D.object_name LIKE 'WR%';
  2490. -------------------默认用户
  2491. SELECT d.username,d.default_tablespace,d.account_status, 'create user '|| d.username|| ' identified by '|| d.username ||' default tablespace '||d.default_tablespace||';' FROM dba_users d WHERE d.username not in ('ANONYMOUS','APEX_030200','APEX_PUBLIC_USER','APPQOSSYS','BI','CTXSYS','DBSNMP','DIP','DMSYS','DVSYS','EXFSYS','FLOWS_FILES','HR','IX','LBACSYS','MDDATA','MDSYS','MGMT_VIEW','OE','OLAPSYS','ORACLE_OCM','ORDDATA','ORDPLUGINS','ORDSYS','OUTLN','OWBSYS','OWBSYS_AUDIT','PM','REMOTE_SCHEDULER_AGENT','SCOTT','SH','SI_INFORMATN_SCHEMA','SI_INFORMTN_SCHEMA','SPATIAL_CSW_ADMIN_USR','SPATIAL_WFS_ADMIN_USR','SYS','SYSMAN','SYSTEM','TSMSYS','WK_TEST','WKPROXY','WKSYS','WMSYS','XDB','XS$NULL','CSMIG');
  2492. -------------------------------------expdp和impdp 数据泵
  2493. `date +%Y%m%d`
  2494. %date:~0,4%%date:~5,2%%date:~8,2%
  2495. set CurDate=%date:~0,4%%date:~5,2%%date:~8,2%
  2496. set hh=%time:~0,2%
  2497. if /i %hh% LSS 10 ( set hh=0%time:~1,1%)
  2498. set ms=%time:~3,2%%time:~6,2%
  2499. set my_date=%CurDate%%hh%%ms%
  2500. grant read,write on directory DATA_PUMP_DIR to LHR;
  2501. grant ALL on directory DATA_PUMP_DIR to LHR;
  2502. windows下用:expdp \"/ AS SYSDBA\"
  2503. -------------导出到服务端
  2504. expdp scott/tiger@orclasm directory=DATA_PUMP_DIR TABLES=EMP,DEPT dumpfile=expdp_by_lhr_`date +%Y%m%d`.dmp LOGFILE=expdp_by_lhr_`date +%Y%m%d`.log
  2505. expdp scott/tiger@orclasm directory=DATA_PUMP_DIR TABLES=EMP,DEPT dumpfile=expdp_by_lhr_%date:~0,4%%date:~5,2%%date:~8,2%.dmp LOGFILE=expdp_by_lhr_%date:~0,4%%date:~5,2%%date:~8,2%.log
  2506. --表级别
  2507. expdp lhr/lhr@orclasm directory=DATA_PUMP_DIR dumpfile=exptable.dmp TABLES=TEST_TSPITR2,TEST_TSPITR3 LOGFILE=expdp_table.log
  2508. expdp scott/tiger@orclasm directory=DATA_PUMP_DIR dumpfile=exptable.dmp TABLES=EMP,DEPT LOGFILE=expdp_table.log
  2509. expdp system/lhr@orclasm DIRECTORY=DATA_PUMP_DIR DUMPFILE=exp_tab.dmp LOGFILE=exp_tab.log SCHEMAS=scott INCLUDE=TABLE:\"IN ('EMP', 'DEPT')\"
  2510. impdp lhr/lhr@orclxp directory=DATA_PUMP_DIR dumpfile=exptable.dmp LOGFILE=impdp_table.log
  2511. --schema级别
  2512. expdp lhr/lhr@orclasm directory=DATA_PUMP_DIR dumpfile=HR.dmp SCHEMAS=HR,SCOTT,TESTUSER LOGFILE=HR.log
  2513. expdp system/oracle@orcl DIRECTORY=DATA_PUMP_DIR DUMPFILE=test_20140324.DMP SCHEMAS=test logfile=test_expdp_20111014.log status=10 parallel=4 CONTENT=ALL COMPRESSION=ALL
  2514. impdp lhr/lhr@orclasm directory=DATA_PUMP_DIR dumpfile=HR.dmp SCHEMAS=HR,SCOTT,TESTUSER parallel=4 LOGFILE=HR_20151125.log
  2515. --整个数据库
  2516. expdp SYSTEM/ORACLE@ORCL DIRECTORY=DATA_PUMP_DIR DUMPFILE=TEST_20140324.DMP SCHEMAS=TEST LOGFILE=TEST_EXPDP_20111014.LOG STATUS=10 PARALLEL=1 CONTENT=ALL FLASHBACK_SCN=18341888 COMPRESSION=ALL
  2517. expdp \'/ AS SYSDBA\' DIRECTORY=DATA_PUMP_DIR FULL=Y DUMPFILE=FULLEXP.DMP LOGFILE=FULLEXP.LOG PARALLEL=2
  2518. impdp \'/ AS SYSDBA\' DIRECTORY=DATA_PUMP_DIR FULL=Y DUMPFILE=FULLEXP.DMP LOGFILE=FULLIMP.LOG PARALLEL=2  TABLE_EXISTS_ACTION=REPLACE EXCLUDE=STATISTICS,SCHEMA,TABLESPACE,ROLE,DIRECTORY,CONTEXT,PROFILE
  2519. impdp LHR/LHR@ORCLASM DIRECTORY=DATA_PUMP_DIR DUMPFILE=HR.DMP SCHEMAS=HR,SCOTT,TESTUSER PARALLEL=4 LOGFILE=HR_20151125.LOG
  2520. expdp SYSTEM/LHR DIRECTORY=DATA_PUMP_DIR DUMPFILE=EXPDP_FULL_20150417.DMP FULL=Y LOGFILE=EXPDP_FULL_20150417.LOG EXCLUDE=STATISTICS
  2521. impdp SYSTEM/LHR DIRECTORY=DATA_PUMP_DIR DUMPFILE=EXPDP_FULL_20150417.DMP FULL=Y LOGFILE=IMPDP_FULL_20150417.LOG PARALLEL=4 EXCLUDE=STATISTICS:"IN('')"
  2522. ORACLE_SID=ORA1024G
  2523. impdp \"/ AS SYSDBA\" DIRECTORY=DATA_PUMP_DIR DUMPFILE=EXPDP_FULL_20150417.DMP FULL=Y LOGFILE=IMPDP_FULL_20150417.LOG JOB_NAME=IMPDP_LHR EXCLUDE=SCHEMA,TABLESPACE,ROLE,DIRECTORY, CONTEXT,PROFILE PARALLEL=2 TABLE_EXISTS_ACTION=REPLACE
  2524. impdp \"/ AS SYSDBA\" DIRECTORY=DATA_PUMP_DIR DUMPFILE=EXPDP_FULL_20150417.DMP FULL=Y LOGFILE=IMPDP_FULL_20150417.LOG JOB_NAME=IMPDP_LHR EXCLUDE=TABLESPACE,ROLE,DIRECTORY, CONTEXT,PROFILE,USER,SCHEMA:\"\=\'SYS\'\",SCHEMA:\"\=\'IX\'\" PARALLEL=2 TABLE_EXISTS_ACTION=REPLACE
  2525. ----全库导出时的排除信息
  2526. more /tmp/exclude_schema.par
  2527. EXCLUDE=STATISTICS,SCHEMA:"in ('SYSTEM','MDSYS','DBSNMP','SCOTT','OUTLN','MGMT_VIEW','FLOWS_FILES','ORDSYS','EXFSYS','WMSYS','APPQOSSYS','APEX_030200','OWBSYS_AUDIT','ORDDATA','CTXSYS','ANONYMOUS','SYSMAN','XDB','ORDPLUGINS','OWBSYS','SI_INFORMTN_SCHEMA','OLAPSYS','ORACLE_OCM','XS$NULL','BI','PM','MDDATA','IX','SH','DIP','OE','APEX_PUBLIC_USER','HR','SPATIAL_CSW_ADMIN_USR','SPATIAL_WFS_ADMIN_USR')"
  2528. ------ query选项
  2529. [ZFZHLHRDB1:oracle]:/oracle>more /tmp/scottfile.par
  2530. query=SCOTT.EMP:"WHERE DEPTNO=20",SCOTT.DEPT:"WHERE DNAME='SALES'"
  2531. [ZFZHLHRDB1:oracle]:/oracle> expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT dumpfile=test_query_lhr_scott_02.dmp parfile=/tmp/scottfile.par log=test_query_lhr_scott_02.log
  2532. ----- include
  2533. expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT dumpfile=test_include_lhr_scott_03.dmp logfile=test_include_lhr_scott_03.log job_name=my_job_lhr include=procedure,function,sequence:"like '%TEST%'"
  2534. include=procedure,function,sequence:"like '%TEST%'"
  2535. include=procedure
  2536. include=function
  2537. include=sequence:"like '%TEST%'"
  2538. expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT dumpfile=test_include_lhr_scott_05.dmp logfile=test_include_lhr_scott_05.log job_name=my_job_lhr parfile=/tmp/parfile.par
  2539. expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT dumpfile='expdp_by_lhr_%date:~0,4%%date:~5,2%%date:~8,2%.dmp' LOGFILE='expdp_by_lhr_%date:~0,4%%date:~5,2%%date:~8,2%.log' job_name=my_job_lhr parfile=/tmp/parfile.par
  2540. -------- trace
  2541. expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR schemas=SCOTT dumpfile=test_query_lhr_scott_02.dmp parfile=/tmp/scottfile.par log=test_query_lhr_scott_02.log trace=4a0300
  2542. --DATABASE_EXPORT_OBJECTS
  2543. --SCHEMA_EXPORT_OBJECTS
  2544. --TABLE_EXPORT_OBJECTS
  2545. --SELECT * FROM DBA_EXPORT_OBJECTS D WHERE D.OBJECT_PATH LIKE '%DB_LINK%' ;
  2546. -----导出job
  2547. expdp system/lhr dumpfile=dmplhr_JOB.dmp directory=data_pump_dir full=y include=JOB
  2548. impdp system/lhr dumpfile=dmplhr_JOB.dmp directory=data_pump_dir full=y include=JOB SQLFILE=expddl_lhr.sql
  2549. ---- 导出dblink
  2550. --所有dblink
  2551. expdp system/lhr dumpfile=dmplhr_dblink.dmp directory=data_pump_dir full=y include=db_link
  2552. --私有dblink
  2553. expdp system/lhr dumpfile=dmplhr_dblink.dmp directory=data_pump_dir schemas=SYS,LHR include=db_link
  2554. --公共dblink
  2555. expdp system/lhr dumpfile=dmplhr_dblink.dmp directory=data_pump_dir full=y include=db_link:\"IN \(SELECT DB_LINK FROM DBA_DB_LINKS WHERE OWNER = \'PUBLIC\'\)\"
  2556. impdp system/lhr dumpfile=dmplhr_dblink.dmp directory=data_pump_dir full=y include=db_link SQLFILE=expddl_lhr.sql
  2557. ---------------filesize参数
  2558. exp userid=scott/tiger file=/tmp/test1,/tmp/test2,/tmp/test3,/tmp/test4,/tmp/test5 filesize=1024000 log=test.log
  2559. imp userid=lhr/lhr FILE=/tmp/test1,/tmp/test2,/tmp/test3,/tmp/test4,/tmp/test5 LOG=imp_emp.log FROMUSER=scott TOUSER=lhr TABLES=emp
  2560. --filesize数据泵示例
  2561. expdp system/lhr SCHEMAS=scott DIRECTORY=DATA_PUMP_DIR DUMPFILE=DATA_PUMP_DIR:expdp_20190416_%U.dmp FILESIZE=1024000
  2562. impdp lhr/lhr SCHEMAS=scott DIRECTORY=DATA_PUMP_DIR DUMPFILE=DATA_PUMP_DIR:expdp_20190416_%U.dmp
  2563. expdp system/lhr SCHEMAS=scott DIRECTORY=DATA_PUMP_DIR DUMPFILE=DATA_PUMP_DIR:expdp_20190416_%U.dmp FILESIZE=10g
  2564. impdp lhr/lhr SCHEMAS=scott DIRECTORY=DATA_PUMP_DIR DUMPFILE=DATA_PUMP_DIR:expdp_20190416_%U.dmp
  2565. ---------------- 导出和导入物化视图
  2566. --不同步数据 TEST_MV是基表 TEST_MV_LHR是物化视图
  2567. expdp system/lhr dumpfile=mview4.dmp schemas=lhr include=TABLE:\"IN \(\'TEST_MV_LHR\'\)\",materialized_view:\"IN \(\'TEST_MV_LHR\'\)\"
  2568. impdp system/lhr dumpfile=mview4.dmp
  2569. --TEST_MV是基表 同步数据
  2570. expdp system/lhr dumpfile=mview5.dmp schemas=lhr include=TABLE:\"IN \(\'TEST_MV_LHR\',\'TEST_MV\'\)\",materialized_view:\"IN \(\'TEST_MV_LHR\'\)\"
  2571. impdp system/lhr dumpfile=mview4.dmp
  2572. exec dbms_mview.refresh('TEST_MV_LHR','C');
  2573. ---导出HR用户下定义的公共同义词 单引号、双引号、小括号 都需要进行转义
  2574. expdp system/lhr dumpfile=dmplhr_syn.dmp directory=data_pump_dir full=y include=DATABASE_EXPORT/SCHEMA/PUBLIC_SYNONYM/SYNONYM:\"IN \(SELECT synonym_name FROM DBA_SYNONYMS WHERE OWNER=\'PUBLIC\' AND TABLE_OWNER=\'HR\'\)\"
  2575. ---------导出到本地
  2576. expdp lhr/lhr@orclxp directory=DATA_PUMP_DIR dumpfile=exptable.dmp TABLES=xb_log_lhr network_link=dblk_orclasm LOGFILE=expdp_table.log
  2577. impdp lhr/lhr@orclxp directory=DATA_PUMP_DIR dumpfile=exptable.dmp LOGFILE=impdp_table.log
  2578. ---- 直接导入 不生成文件
  2579. impdp lhr/lhr@orclxp network_link=dblk_orclasm directory=DATA_PUMP_DIR TABLES=xb_log_lhr PARALLEL=2 LOGFILE=impdp_table.log
  2580. ---- 生成ddl语句 不会导入数据 metadata_only表示不导出表中数据,但是其它元数据会导出的,包括存储过程、函数定义等
  2581. --expdp \'/ AS SYSDBA\' tables=lhr.exptest directory=DATA_PUMP_DIR dumpfile=exptest.dmp logfile=exp_exptest.dmp EXCLUDE=STATISTICS
  2582. --expdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR dumpfile=lhrsql20161215.dmp logfile=lhrsql20161215.log content=metadata_only schemas=SCOTT EXCLUDE=STATISTICS
  2583. impdp \'/ AS SYSDBA\' directory=DATA_PUMP_DIR dumpfile=lhrsql20161215.dmp logfile=imp_exptest.log sqlfile=exptest.sql
  2584. exp \'/ AS SYSDBA\' tables=scott.emp file=/tmp/exp_ddl_lhr_01.dmp log=/tmp/exp_table.log buffer=41943040 rows=n compress=n
  2585. imp \'/ AS SYSDBA\' file=/tmp/exp_ddl_lhr_01.dmp show=y log=/tmp/get_ddl.sql buffer=20480000 full=y
  2586. set pagesize 0
  2587. set trimspool ON
  2588. SET linesize 10000
  2589. set 90000
  2590. set feedback OFF
  2591. set feed off;
  2592. set echo off
  2593. spool schema_scott.sql
  2594. SELECT DBMS_METADATA.GET_DDL(U.OBJECT_TYPE, U.OBJECT_NAME,U.owner)
  2595. FROM DBA_OBJECTS U
  2596. WHERE U.OBJECT_TYPE IN ('TABLE', 'INDEX', 'PROCEDURE', 'FUNCTION''PACKAGE','TRIGGER')
  2597. AND U.owner='SCOTT';
  2598. spool off;
  2599. ----只导出表结构
  2600. expdp lhr/lhr directory=DATA_PUMP_DIR dumpfile=lhrsql20150515.dmp logfile=lhrsql20150515.log content=metadata_only schemas=TEST,SQCHECK,DWUSER
  2601. impdp lhr/lhr directory=DATA_PUMP_DIR dumpfile=lhrsql20150515.dmp logfile=imp_exptest.log sqlfile=lhrsql20150515.sql
  2602. impdp lhr/lhr directory=DATA_PUMP_DIR dumpfile=lhrsql20150515.dmp logfile=lhrsql20150515_imp.log
  2603. impdp lhr/lhr directory=DATA_PUMP_DIR dumpfile=lhrsql20150515.dmp logfile=imp_exptest.log TRANSFORM=storage:n TRANSFORM=SEGMENT_CREATION:n
  2604. impdp lhr/lhr directory=DATA_PUMP_DIR dumpfile=lhrsql20150515.dmp logfile=imp_exptest.log sqlfile=lhrsql20150515.sql TRANSFORM=segment_attributes:n
  2605. --transform=segment_attributes|storage|SEGMENT_CREATION|oid|pctspace:Y/N:object_type
  2606. ----修改对象schema和tablespace
  2607. impdp test/test directory=exp_dump dumpfile=test.dmp logfile=test.log remap_schema=test1:test2 remap_tablespace=TBS_DAT_1:TBS_DAT_2,TBS_IDX_1:TBS_IDX_2
  2608. impdp test/test directory=exp_dump dumpfile=test.dmp logfile=test.log remap_schema=test1:test2 remap_tablespace=TBS_DAT_1:TBS_DAT_2 remap_tablespace=TBS_IDX_1:TBS_IDX_2
  2609. ----显示时间
  2610. expdp SCOTT/tiger@orclasm DIRECTORY=DATA_PUMP_DIR DUMPFILE=SCOTT%U.dmp SCHEMAS=SCOTT COMPRESSION=all metrics=y
  2611. --dmp文件重用 reuse_dumpfiles=y
  2612. expdp \''sys/"l@h\r/0"'@LHRDB as sysdba\' DIRECTORY=DATA_PUMP_DIR DUMPFILE=dmp_SCOTT.dmp SCHEMAS=SCOTT reuse_dumpfiles=y
  2613. #scp -r root@10.0.24.103:/home2/backup/ /home/mover00/shadow_bak/sites/
  2614. 拷贝远程(10.0.24.103)的/home2/backup/ 到本地的 /home/mover00/shadow_bak/sites/
  2615. #scp -r /home2/backup/ root@10.0.24.99:/home/mover00/shadow_bak/sites/
  2616. 拷贝本地的/home2/backup/ 到远程(10.0.24.99)的 /home/mover00/shadow_bak/sites/
  2617. ---------------------------如何彻底停止expdp进程?
  2618. SET LINE 9999
  2619. COL OWNER_NAME FOR A10
  2620. COL JOB_NAME FOR A25
  2621. COL OPERATION FOR A10
  2622. COL JOB_MODE FOR A10
  2623. COL STATE FOR A15
  2624. COL OSUSER FOR A10
  2625. COL "DEGREE|ATTACHED|DATAPUMP" FOR A25
  2626. COL SESSION_INFO FOR A20
  2627. SELECT DS.INST_ID,
  2628. DJ.OWNER_NAME,
  2629. DJ.JOB_NAME,
  2630. TRIM(DJ.OPERATION) OPERATION,
  2631. TRIM(DJ.JOB_MODE) JOB_MODE,
  2632. DJ.STATE,
  2633. DJ.DEGREE || ',' || DJ.ATTACHED_SESSIONS || ',' ||DJ.DATAPUMP_SESSIONS "DEGREE|ATTACHED|DATAPUMP",
  2634. DS.SESSION_TYPE,
  2635. S.OSUSER ,
  2636. (SELECT S.SID || ',' || S.SERIAL# || ',' || P.SPID
  2637. FROM GV$PROCESS P
  2638. WHERE S.PADDR = P.ADDR
  2639. AND S.INST_ID = P.INST_ID) SESSION_INFO
  2640. FROM DBA_DATAPUMP_JOBS DJ --GV$DATAPUMP_JOB
  2641. FULL OUTER JOIN DBA_DATAPUMP_SESSIONS DS --GV$DATAPUMP_SESSION
  2642. ON (DJ.JOB_NAME = DS.JOB_NAME AND DJ.OWNER_NAME = DS.OWNER_NAME)
  2643. LEFT OUTER JOIN GV$SESSION S
  2644. ON (S.SADDR = DS.SADDR AND DS.INST_ID = S.INST_ID)
  2645. ORDER BY DJ.OWNER_NAME, DJ.JOB_NAME;
  2646. select * from GV$DATAPUMP_SESSION;
  2647. select * from GV$datapump_jobs;
  2648. select * From dba_datapump_jobs;
  2649. impdp \"/ as sysdba\" attach=IMPDP_LHR
  2650. ------------- parfile
  2651. [root@rhel6_lhr dpdump]# more par.f
  2652. DUMPFILE=EXPDAT.DMP
  2653. DIRECTORY=DATA_PUMP_DIR
  2654. TRANSPORT_DATAFILES=
  2655. /u01/app/oracle/admin/orclasm/dpdump/APP1TBS.DBF,
  2656. /u01/app/oracle/admin/orclasm/dpdump/APP2TBS.DBF,
  2657. /u01/app/oracle/admin/orclasm/dpdump/IDXTBS.DBF
  2658. LOGFILE=tts_import.log
  2659. [root@rhel6_lhr dpdump]#
  2660. [oracle@rhel6 ~]$ impdp system/lhr parfile='/u01/app/oracle/admin/orclasm/dpdump/par.f'
  2661. ----查看用户的目录权限
  2662. column grantee format a10
  2663. column grantor format a10
  2664. column dir_name format a20
  2665. column dir_path format a50
  2666. column privilege format a10
  2667. break on dir_name
  2668. select
  2669. d.directory_name dir_name,
  2670. d.directory_path dir_path,
  2671. p.privilege,
  2672. p.grantee,
  2673. p.grantor
  2674. from
  2675. dba_tab_privs p,
  2676. dba_directories d
  2677. where
  2678. p.table_name = d.directory_name and
  2679. p.grantee = upper('&user')
  2680. order by
  2681. d.directory_name,
  2682. p.privilege
  2683. /
  2684. CREATE USER LHRSYS IDENTIFIED BY LHRSYS;
  2685. GRANT UPDATE (ENAME,SAL) ON SCOTT.EMP TO LHRSYS;
  2686. GRANT UPDATE (ENAME) ON SCOTT.EMP TO LHRSYS;
  2687. GRANT SELECT ON SCOTT.EMP TO LHRSYS;
  2688. GRANT CONNECT TO LHRSYS;
  2689. GRANT CREATE JOB TO LHRSYS;
  2690. SELECT * FROM DBA_COL_PRIVS D WHERE D.GRANTEE='LHRSYS';
  2691. SELECT * FROM DBA_TAB_PRIVS D WHERE D.GRANTEE='LHRSYS';
  2692. SELECT * FROM DBA_SYS_PRIVS D WHERE D.GRANTEE='LHRSYS';
  2693. SELECT * FROM DBA_ROLE_PRIVS D WHERE D.GRANTEE='LHRSYS';
  2694. 1、给表加注释
  2695. COMMENT ON TABLE TABLENAME IS '用户表';
  2696. 2、查看表的COMMENT
  2697. SELECT * FROM USER_TAB_COMMENTS WHERE TABLE_NAME='TABLENAME';
  2698. 3、给字段加注释
  2699. COMMENT ON COLUMN TABLENAME.COLNAME IS 'OOXX';
  2700. 4、查看字段的COMMENT
  2701. SELECT * FROM USER_COL_COMMENTS WHERE TABLE_NAME='TABLENAME';
  2702. --查看创建表SQL语句:
  2703. SELECT DBMS_METADATA.GET_DDL('TABLE','DEPT','SCOTT') FROM DUAL;
  2704. SELECT DBMS_METADATA.GET_DDL('TABLE',U.TABLE_NAME) FROM USER_TABLES U;
  2705. --查看创建索引的SQL语句:
  2706. SELECT DBMS_METADATA.GET_DDL('INDEX','PK_DEPT','SCOTT') FROM DUAL;
  2707. SELECT DBMS_METADATA.GET_DDL('INDEX',U.INDEX_NAME) FROM USER_INDEXES U;
  2708. --查看创建主键的SQL语句:
  2709. SELECT DBMS_METADATA.GET_DDL('CONSTRAINT','EMP_PK') FROM DUAL;
  2710. --查看创建外键的SQL语句:
  2711. SELECT DBMS_METADATA.GET_DDL('REF_CONSTRAINT','EMP_FK_DEPT') FROM DUAL;
  2712. --查看创建视图(VIEW)的SQL语句:
  2713. SELECT DBMS_METADATA.GET_DDL('VIEW', 'MY_TABLES','SCOTT') FROM DUAL;
  2714. SELECT DBMS_METADATA.GET_DDL('VIEW', U.OBJECT_NAME)
  2715. FROM USER_OBJECTS U
  2716. WHERE OBJECT_TYPE = 'VIEW';
  2717. SELECT TEXT FROM USER_VIEWS WHERE VIEW_NAME=UPPER('&VIEW_NAME');
  2718. --查看创建存储过程(PROCEDURE)的SQL语句:
  2719. SELECT DBMS_METADATA.GET_DDL('PROCEDURE', U.OBJECT_NAME)
  2720. FROM USER_OBJECTS U
  2721. WHERE OBJECT_TYPE = 'PROCEDURE';
  2722. --查看创建触发器(TRIGGER)的SQL语句:
  2723. SELECT DBMS_METADATA.GET_DDL('TRIGGER', U.OBJECT_NAME)
  2724. FROM USER_OBJECTS U
  2725. WHERE OBJECT_TYPE = 'TRIGGER';
  2726. --查看创建函数(FUNCTION)的SQL语句:
  2727. SELECT DBMS_METADATA.GET_DDL('FUNCTION', U.OBJECT_NAME)
  2728. FROM USER_OBJECTS U
  2729. WHERE OBJECT_TYPE = 'FUNCTION';
  2730. --查看创建包(PACKAGE)的SQL语句:
  2731. SELECT DBMS_METADATA.GET_DDL('PACKAGE', U.OBJECT_NAME)
  2732. FROM USER_OBJECTS U
  2733. WHERE OBJECT_TYPE = 'PACKAGE';
  2734. --查看创建序列(SEQUENCE)的SQL语句:
  2735. SELECT DBMS_METADATA.GET_DDL('SEQUENCE', U.OBJECT_NAME)
  2736. FROM USER_OBJECTS U
  2737. WHERE OBJECT_TYPE = 'SEQUENCE';
  2738. --查看创建同义词(SYNONYM)的SQL语句:
  2739. SELECT DBMS_METADATA.GET_DDL('SYNONYM', U.OBJECT_NAME)
  2740. FROM USER_OBJECTS U
  2741. WHERE OBJECT_TYPE = 'SYNONYM';
  2742. --查看创建表空间(TABLESPACE)的SQL语句:
  2743. SELECT DBMS_METADATA.GET_DDL('TABLESPACE', U.TABLESPACE_NAME)
  2744. FROM USER_TABLESPACES U;
  2745. --查看创建角色(ROLE)的SQL语句:
  2746. SELECT DBMS_METADATA.GET_DDL('ROLE', U.ROLE) FROM DBA_ROLES U;
  2747. --查看创建用户(USER)的SQL语句:
  2748. SELECT DBMS_METADATA.GET_DDL('USER','SYS') FROM DUAL;
  2749. ------------------------- 得到表空间DDL语句
  2750. SELECT (SELECT b.NAME FROM v$tablespace b WHERE b.TS# = a.TS#) ts_name,
  2751. a.NAME datafilename,
  2752. 'create tablespace '||(SELECT b.NAME FROM v$tablespace b WHERE b.TS# = a.TS#) || ' datafile ' || a.NAME ||' size ;'
  2753. FROM v$datafile a;
  2754. SELECT TABLESPACE_NAME,
  2755. substr(create_ts, 1, instr(create_ts, 'EXTENT') - 1) || ';'
  2756. FROM (SELECT a.TABLESPACE_NAME,
  2757. replace(to_char(DBMS_METADATA.GET_DDL('TABLESPACE',
  2758. a.tablespace_name)),
  2759. chr(10),
  2760. '') create_ts
  2761. FROM DBA_TABLESPACES a) v
  2762. where v.TABLESPACE_NAME not in
  2763. ('SYSTEM', 'SYSAUX', 'UNDOTBS1', 'TEMP', 'USERS', 'EXAMPLE');
  2764. ------------------------- 得到用户及其权限的DDL语句
  2765. SELECT DBMS_METADATA.GET_DDL('USER','LHRSYS') DDL_SQL FROM DUAL
  2766. UNION ALL
  2767. SELECT ((DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT', 'LHRSYS'))) FROM DUAL
  2768. UNION ALL
  2769. SELECT ((DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT', 'LHRSYS'))) FROM DUAL
  2770. UNION ALL
  2771. SELECT ((DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT', 'LHRSYS'))) FROM DUAL;
  2772. drop table t_tmp_user_lhr;
  2773. create table t_tmp_user_lhr( id number, username varchar2(50), exec_sql varchar2(4000),create_type varchar2(20) );
  2774. DROP sequence s_t_tmp_user_lhr;
  2775. create sequence s_t_tmp_user_lhr;
  2776. begin
  2777. for cur in (SELECT d.username,
  2778. d.default_tablespace,
  2779. d.account_status,
  2780. 'create user ' || d.username || ' identified by ' ||
  2781. d.username || ' default tablespace ' ||
  2782. d.default_tablespace || ' TEMPORARY TABLESPACE ' ||
  2783. D.temporary_tablespace || ';' CREATE_USER,
  2784. replace(to_char(DBMS_METADATA.GET_DDL('USER',
  2785. D.username)),
  2786. chr(10),
  2787. '') create_USER1
  2788. FROM dba_users d
  2789. WHERE d.username not in ('ANONYMOUS','APEX_030200','APEX_PUBLIC_USER','APPQOSSYS','BI','CTXSYS','DBSNMP','DIP','DMSYS','DVSYS','EXFSYS','FLOWS_FILES','HR','IX','LBACSYS','MDDATA','MDSYS','MGMT_VIEW','OE','OLAPSYS','ORACLE_OCM','ORDDATA','ORDPLUGINS','ORDSYS','OUTLN','OWBSYS','OWBSYS_AUDIT','PM','REMOTE_SCHEDULER_AGENT','SCOTT','SH','SI_INFORMATN_SCHEMA','SI_INFORMTN_SCHEMA','SPATIAL_CSW_ADMIN_USR','SPATIAL_WFS_ADMIN_USR','SYS','SYSMAN','SYSTEM','TSMSYS','WK_TEST','WKPROXY','WKSYS','WMSYS','XDB','XS$NULL','CSMIG')) loop
  2790. INSERT INTO t_tmp_user_lhr
  2791. (id, username, exec_sql, create_type)
  2792. values
  2793. (s_t_tmp_user_lhr.nextval, cur.username, cur.CREATE_USER, 'USER');
  2794. INSERT INTO t_tmp_user_lhr
  2795. (id, username, exec_sql, create_type)
  2796. SELECT s_t_tmp_user_lhr.nextval,
  2797. cur.username,
  2798. CASE
  2799. WHEN D.ADMIN_OPTION = 'YES' THEN
  2800. 'GRANT ' || d.privilege || ' TO ' || d.GRANTEE ||
  2801. ' WITH GRANT OPTION ;'
  2802. ELSE
  2803. 'GRANT ' || d.privilege || ' TO ' || d.GRANTEE || ';'
  2804. END priv,
  2805. 'DBA_SYS_PRIVS'
  2806. FROM dba_sys_privs d
  2807. WHERE D.GRANTEE = CUR.USERNAME;
  2808. INSERT INTO t_tmp_user_lhr
  2809. (id, username, exec_sql, create_type)
  2810. SELECT s_t_tmp_user_lhr.nextval,
  2811. cur.username,
  2812. CASE
  2813. WHEN D.ADMIN_OPTION = 'YES' THEN
  2814. 'GRANT ' || d.GRANTED_ROLE || ' TO ' || d.GRANTEE ||
  2815. ' WITH GRANT OPTION;'
  2816. ELSE
  2817. 'GRANT ' || d.GRANTED_ROLE || ' TO ' || d.GRANTEE || ';'
  2818. END priv,
  2819. 'DBA_ROLE_PRIVS'
  2820. FROM DBA_ROLE_PRIVS d
  2821. WHERE D.GRANTEE = CUR.USERNAME;
  2822. INSERT INTO t_tmp_user_lhr
  2823. (id, username, exec_sql, create_type)
  2824. SELECT s_t_tmp_user_lhr.nextval,
  2825. cur.username,
  2826. CASE
  2827. WHEN d.grantable = 'YES' THEN
  2828. 'GRANT ' || d.privilege || ' ON ' || d.owner || '.' ||
  2829. d.table_name || ' TO ' || d.GRANTEE ||
  2830. ' WITH GRANT OPTION ;'
  2831. ELSE
  2832. 'GRANT ' || d.privilege || ' ON ' || d.owner || '.' ||
  2833. d.table_name || ' TO ' || d.GRANTEE || ';'
  2834. END priv,
  2835. 'DBA_TAB_PRIVS'
  2836. FROM DBA_TAB_PRIVS d
  2837. WHERE D.GRANTEE = CUR.USERNAME;
  2838. end loop;
  2839. COMMIT;
  2840. end;
  2841. /
  2842. SELECT * FROM t_tmp_user_lhr;
  2843. ------------------------------------------------------------------------------------------------------------------------------
  2844. ------------------------------------------------------------------------------------------------------------------------------
  2845. ---怎么批量去除WORD里表格中的超链接
  2846. 全选文档。按"Ctrl+shift+F9"断开连接就行了。
  2847. ------------------------------------------------------------------------------------------------------------------------------
  2848. ------------------------------------------------------------------------------------------------------------------------------
  2849. ----linux下批量查找/替换文本内容
  2850. --一般在本地电脑上批量替换文本有许多工具可以做到,比如sublime text ,但大多服务器上都是无图形界面的,为此收集了几条针对linux命令行 实现批量替换文本内容的命令:
  2851. --1.批量查找某个目下文件的包含的内容,例如:
  2852. # grep -rn "要找查找的文本" ./
  2853. [oracle@rhel6_lhr dpdump]$ grep -rn "ALTER SESSION SET EVENTS" ./
  2854. ./spool_result.sql:2:ALTER SESSION SET EVENTS '10150 TRACE NAME CONTEXT FOREVER, LEVEL 1';
  2855. ./spool_result.sql:3:ALTER SESSION SET EVENTS '10904 TRACE NAME CONTEXT FOREVER, LEVEL 1';
  2856. ./spool_result.sql:4:ALTER SESSION SET EVENTS '25475 TRACE NAME CONTEXT FOREVER, LEVEL 1';
  2857. ./spool_result.sql:5:ALTER SESSION SET EVENTS '10407 TRACE NAME CONTEXT FOREVER, LEVEL 1';
  2858. ./spool_result.sql:6:ALTER SESSION SET EVENTS '10851 TRACE NAME CONTEXT FOREVER, LEVEL 1';
  2859. ./spool_result.sql:7:ALTER SESSION SET EVENTS '22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 ';
  2860. --2.批量查找并替换文件内容。
  2861. # sed -i "s/要找查找的文本/替换后的文本/g" `grep -rl "要找查找的文本" ./`
  2862. 例如替换 被病毒修改的一段脚本:
  2863. sed -i "s/<script type=\"text\/javascript\" src='http:\/\/t.cn\/RhyQ1GN'><\/script>//g" `grep -rl "<script type=\"text\/javascript\" src='http:\/\/t.cn\/RhyQ1GN'><\/script>" ./`
  2864. ----将STORAGE(INITIAL开头的行整行替换为STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  2865. -- 必须加 点和星号和最后的g ,否则不能整行替换
  2866. sed 's/^STORAGE(INITIAL.*/STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645/g' a.txt > b.txt
  2867. -------------------------------------------------------------------------------------------------------------- 修改日期的显示格式
  2868. execute immediate 'alter session set NLS_DATE_FORMAT=''YYYY-MM-DD DY HH24:MI:SS''';
  2869. alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
  2870. alter system set nls_date_format='yyyy-mm-dd hh24:mi:ss' scope=spfile;
  2871. ----------------------------------------------------------------------------- sqlplus 设置
  2872. --$ORACLE_HOME/sqlplus/admin/glogin.sql
  2873. sqlplus中的清屏命令: clear scr
  2874. --修改提示符
  2875. set linesize 9999 pagesize 9999
  2876. set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "
  2877. set time on;
  2878. set line 9999
  2879. set pagesize 9999;
  2880. set timing on;
  2881. set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "
  2882. set echo on;
  2883. set time on;
  2884. SET 99999999;
  2885. SET CHUNKSIZE 1000000;
  2886. set timing on;
  2887. set serveroutput on size 1000000;
  2888. set sqlblanklines on;
  2889. set linesize 800;
  2890. set pagesize 50000;
  2891. set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "
  2892. host color 02
  2893. alter session set NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
  2894. set errorlogging on table lhr.sperrorlog;
  2895. set errorlogging on identifier LHR_SESSION


 



About Me

........................................................................................................................

● 本文作者:小麦苗,部分内容整理自网络,若有侵权请联系小麦苗删除

● 本文在itpub、博客园、CSDN和个人微 信公众号( xiaomaimiaolhr)上有同步更新

● 本文itpub地址: http://blog.itpub.net/26736162

● 本文博客园地址: http://www.cnblogs.com/lhrbest

● 本文CSDN地址: https://blog.csdn.net/lihuarongaini

● 本文pdf版、个人简介及小麦苗云盘地址: http://blog.itpub.net/26736162/viewspace-1624453/

● 数据库笔试面试题库及解答: http://blog.itpub.net/26736162/viewspace-2134706/

● DBA宝典今日头条号地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

........................................................................................................................

● QQ群号: 230161599 、618766405

● 微 信群:可加我微 信,我拉大家进群,非诚勿扰

● 联系我请加QQ好友 ( 646634621 ),注明添加缘由

● 于 2019-09-01 06:00 ~ 2019-09-31 24:00 在西安完成

● 最新修改时间:2019-09-01 06:00 ~ 2019-09-31 24:00

● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解

● 版权所有,欢迎分享本文,转载请保留出处

........................................................................................................................

● 小麦苗的微店: https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

● 小麦苗出版的数据库类丛书: http://blog.itpub.net/26736162/viewspace-2142121/

● 小麦苗OCP、OCM、高可用网络班: http://blog.itpub.net/26736162/viewspace-2148098/

● 小麦苗腾讯课堂主页: https://lhr.ke.qq.com/

........................................................................................................................

使用 微 信客户端扫描下面的二维码来关注小麦苗的微 信公众号( xiaomaimiaolhr)及QQ群(DBA宝典)、添加小麦苗微 信, 学习最实用的数据库技术。

 

........................................................................................................................

  

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/277088
推荐阅读
相关标签
  

闽ICP备14008679号