[20140928]資料庫建立在記憶體中.txt

lfree發表於2014-09-28

[20140928]資料庫建立在記憶體中.txt

--單位正好到了幾臺新機器,記憶體128G.
--測試一下dbca slient建立資料庫,因為完成後可以丟棄,把資料庫建立在記憶體中.

# mkdir -p /mnt/ramdisk
# mount -t tmpfs -o size=8G tmpfs /mnt/ramdisk
# su - oracle
--檢查環境變數是否設定正確
$ env | grep -i oracle
USER=oracle
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/db_1/lib:/u01/app/oracle/product/11.2.0/db_1/oracm/lib:/lib:/usr/lib:/usr/local/lib:/lib64:/usr/lib64:/usr/local/lib64
ORACLE_BASE=/u01/app/oracle
PATH=.:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/NX/bin:/home/oracle/bin:/home/oracle/bin:/u01/app/oracle/product/11.2.0/db_1/bin
HOME=/home/oracle
LOGNAME=oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1

$ echo $NLS_LANG
AMERICAN_AMERICA.zhs16gbk

$ export ORACLE_SID=

$ORACLE_HOME/bin/dbca -createDatabase -templateName General_Purpose.dbc -gdbName test -sid test -sysPassword oracle \
-systemPassword oracle -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -listeners LISTENER -sampleSchema  true -totalMemory 800 \
-databaseType MULTIPURPOSE -silent -datafileDestination /mnt/ramdisk


$ export ORACLE_SID=test
$ rlsql

SQL*Plus: Release 11.2.0.3.0 Production on Sun Sep 28 17:03:19 2014

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show sga

Total System Global Area  626327552 bytes
Fixed Size                  2230952 bytes
Variable Size             184550744 bytes
Database Buffers          432013312 bytes
Redo Buffers                7532544 bytes


SQL> host ls -l /mnt/ramdisk/test/
total 1796032
-rw-r----- 1 oracle oinstall   9748480 Sep 28 17:03 control01.ctl
-rw-r----- 1 oracle oinstall 328343552 Sep 28 17:02 example01.dbf
-rw-r----- 1 oracle oinstall  52429312 Sep 28 17:02 redo01.log
-rw-r----- 1 oracle oinstall  52429312 Sep 28 17:02 redo02.log
-rw-r----- 1 oracle oinstall  52429312 Sep 28 17:02 redo03.log
-rw-r----- 1 oracle oinstall 545267712 Sep 28 17:02 sysaux01.dbf
-rw-r----- 1 oracle oinstall 744497152 Sep 28 17:02 system01.dbf
-rw-r----- 1 oracle oinstall  20979712 Sep 28 17:01 temp01.dbf
-rw-r----- 1 oracle oinstall  26222592 Sep 28 17:02 undotbs01.dbf
-rw-r----- 1 oracle oinstall   5251072 Sep 28 17:02 users01.dbf


--測試ok.這樣正常5分鐘就可以建立一個測試資料庫.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1283884/,如需轉載,請註明出處,否則將追究法律責任。

相關文章