CentOS 6.10 インストール
CentOSは Minimal でインストール
既にサポートも終わってるので以下からダウンロード
https://ftp.iij.ad.jp/pub/linux/centos-vault/6.10/isos/x86_64/
CentOS-6.10-x86_64-minimal.iso
通常どおりインストール
yum調整
サポート終わってるので。。
yum設定ファイルをバックアップ
sudo cp -p /etc/yum.repos.d/CentOS-Base.repo{,_bak}
yum設定ファイルのURL書き換え
sudo sed -i -e "s/^mirrorlist=http:\\/\\/mirrorlist.centos.org/#mirrorlist=http:\\/\\/mirrorlist.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
sudo sed -i -e "s/^#baseurl=http:\\/\\/mirror.centos.org/baseurl=http:\\/\\/vault.centos.org/g" /etc/yum.repos.d/CentOS-Base.repo
epel
こちらもサポート終わってるので色々書き換え
sudo yum install epel-release perl
epel バックアップ
sudo cp -p /etc/yum.repos.d/epel.repo{,_bak}
sudo cp -p /etc/yum.repos.d/epel-testing.repo{,_bak}
epel URL書き換え
sudo perl -i -pe 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/epel.repo
sudo perl -i -pe 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/epel-testing.repo
sudo perl -i -pe 's|#baseurl=http://download.fedoraproject.org/pub/|baseurl=http://archives.fedoraproject.org/pub/archive/|g' /etc/yum.repos.d/epel.repo
sudo perl -i -pe 's|#baseurl=http://download.fedoraproject.org/|baseurl=http://archives.fedoraproject.org/|g' /etc/yum.repos.d/epel-testing.repo
Oracle11g XE インストール
Oracle11g XE 用の rpm は配布が終わってるようです。
今更ながら11g 環境が必要になったので..しかもSJISで..
メモとして残しておきます。
HOSTS 設定
vi /etc/hosts
127.0.0.1 ホスト名 localhost
最新化
yum update -y
Oracle インストール用ツールインストール
yum install bc binutils libaio
yum groupinstall '開発ツール'
Oracle 11g XE インストール
yum localinstall oracle-xe-11.2.0-1.0.x86_64.rpm
Oracle 共有ライブラリ登録
echo /u01/app/oracle/product/11.2.0/xe/lib/ > /etc/ld.so.conf.d/oracle.conf
ldconfig
ldconfig -v | grep ora
Oracle 初期設定
# /etc/init.d/oracle-xe configure
Oracle Database 11g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 11g Express
Edition. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press <Enter> to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:
Confirm the password:
Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
#
Oracle 環境設定
cat << EOT >> ~/.bashrc
if [ -f /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh ]; then
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
fi
EOT
sqlplus カーソル履歴操作(EPELも追加)
yum install epel-release
yum install rlwrap readline-devel
cat << EOT >> ~/.bashrc
alias sqlplus='rlwrap sqlplus '
EOT
SJIS 化
参考:http://www.ajisaba.net/db/ora_linux_sjis.html
SJIS化についてはこちらの参考ページが良く書かれているので以下はほぼそのままです。
ありがとうございます。
spfile 作成
# su - oracle
$ . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
$ cd /u01/app/oracle/product/11.2.0/xe/dbs
$ sqlplus / as sysdba
SQL> create pfile = 'initXE.ora' from spfile = 'spfileXE.ora';
データベース削除
$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup restrict mount
SQL> drop database;
SQL> quit
データベース作成用スクリプト
vi /u01/app/oracle/product/11.2.0/xe/dbs/createdb.sql
CREATE DATABASE XE
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/XE/redo01a.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/XE/redo02a.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/XE/redo03a.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET JA16SJIS
NATIONAL CHARACTER SET UTF8
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/XE/system01.dbf'
SIZE 325M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
SYSAUX DATAFILE '/u01/app/oracle/oradata/XE/sysaux01.dbf'
SIZE 325M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/XE/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/XE/temp01.dbf'
SIZE 20M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/XE/undo01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
シフトJISのデータベース作成
# su - oracle
$ . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
$ cd /u01/app/oracle/product/11.2.0/xe/dbs
$ sqlplus / as sysdba
SQL> startup nomount pfile=initXE.ora
SQL> @createdb.sql
SQL> @/u01/app/oracle/product/11.2.0/xe/rdbms/admin/catalog.sql
SQL> @/u01/app/oracle/product/11.2.0/xe/rdbms/admin/catproc.sql
SQL> SET SERVEROUTPUT OFF
SQL> connect system/manager
SQL> @/u01/app/oracle/product/11.2.0/xe/sqlplus/admin/pupbld.sql
キャラクタセットの確認
SQL> SELECT PARAMETER, VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER LIKE '%CHARACTERSET%';
PARAMETER
--------------------------------------------------------------------------------
VALUE
--------------------------------------------------------------------------------
NLS_CHARACTERSET
JA16SJIS