升级Ubuntu 12.04为Ubuntu 14.04
do-release-upgrade
创建swap交换分区
1)、以root权限登录SSH,键入如下命令创建3000M的swap文件(1024 * 3000MB = 3072000).
dd if=/dev/zero of=/tmp/swap bs=1024 count=3072000
2)、创建Linux交换文件
mkswap /tmp/swap
3)、立即激活 /tmp/swap 交换文件
swapon /tmp/swap
4)、设置系统自激活交换文件。编辑 /etc/fstab文件,并增加如下第二行代码。
vi /etc/fstab
/tmp/swap swap swap defaults 0 0
5)、重启系统,使用free -m查看swap大小。
# top
top - 18:49:26 up 44 min, 2 users, load average: 1.03, 1.39, 0.66
Tasks: 59 total, 2 running, 57 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.2%sy, 0.0%ni, 98.2%id, 1.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 1541188k total, 1527256k used, 13932k free, 4372k buffers
Swap: 3071992k total, 0k used, 3071992k free, 1442840k cached
6)、如果需要卸载这个 swap 文件,可以进入建立的 swap 文件目录。执行下列命令。
swapoff swapfile
需要确保环境变量中文的UTF支持,可运行:
locale
看到如下就是正确的了:
LANG=zh_CN.UTF-8
如果不是,可修改:
sudo vim /etc/default/locale
LANG="zh_CN.UTF-8″
如果安装有问题,需要完全卸载,可:
apt-get remove --purge oracle-xe
0. backup. If you have a previous oracle install backup your databases with expdp. Warn: move the dumps to a safe location since the apt-get remove –purge could delete them.
1. download the package
wget -c http://download.oracle.com/otn/linux/oracle11g/xe/oracle-xe-11.2.0-1.0.x86_64.rpm.zip?AuthParam=1411966763_2d5ea78e7153c1010e9080957a804a14
2. unzip it
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
3. convert it to a deb and install it
cd Disk1
alien --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
apt-get remove --purge oracle-xe-universal #remove 10g if needed
apt-get install libaio1 #oracle needs this
dpkg -i oracle-xe_11.2.0-2_amd64.deb
(you might get a missing chkconfig error which can be ignored)
Selecting previously unselected package oracle-xe.
(正在读取数据库 ... 系统当前共安装有 69231 个文件和目录。)
Preparing to unpack oracle-xe_11.2.0-2_amd64.deb ...
Unpacking oracle-xe (11.2.0-2) ...
正在设置 oracle-xe (11.2.0-2) ...
Executing post-install steps...
/var/lib/dpkg/info/oracle-xe.postinst: 行 77: bc: 未找到命令
/var/lib/dpkg/info/oracle-xe.postinst: 行 78: bc: 未找到命令
/var/lib/dpkg/info/oracle-xe.postinst: 第 79 行: [: -gt: 期待一元表达式
/var/lib/dpkg/info/oracle-xe.postinst: 行 83: bc: 未找到命令
录ar/lib/dpkg/info/oracle-xe.postinst: 行 114: /sbin/chkconfig: 没有那个文件或目
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the
database.
解决方法:
<1>安装bc: apt-get install bc
<2>要修改/var/lib/dpkg/info/oracle-xe.postinst脚本
1
2
3
4
5
6
7
8
9
|
if
[ -f
/etc/SuSE-release
]
then
cp
-f
/u01/app/oracle/product/11
.2.0
/xe/config/scripts/oracle-xe
.sles
/etc/init
.d
/oracle-xe
/usr/lib/lsb/install_initd
/etc/init
.d
/oracle-xe
>
/dev/null
2>&1
/sbin/insserv
/etc/init
.d
/oracle-xe
>
/dev/null
2>&1
/sbin/SuSEconfig
>
/dev/null
2>&1
#else
# /sbin/chkconfig --add oracle-xe
fi
|
把else与/sbin/chkconfig --add oracle-xe注释掉,然后再执行
1
|
sudo
/var/lib/dpkg/info/oracle-xe
.postinst
|
会提示你运行/etc/init.d/oracle-xe configure进行配置。但别急,我们还需要一些步骤再执行。
4. until now everything is simple, now the trouble begins. The main oracle problem is with the missing /dev/shm which, in 12.04 is a link to /run/shm. The fix for this is to remove the link and mount it yourself:
rm /dev/shm
mkdir /dev/shm
mount -t tmpfs shmfs -o size=2048m /dev/shm
sysctl kernel.shmmax=1073741824 #also edit /etc/sysctl.conf and set the same value to persist the change
4.1 the above changes can be integrated in /etc/init.d/oracle-xe
change the AWK path: /usr/bin/awk
change /var/lock/subsys with /var/lock
add the /dev/shm lines
解决ORA-00845: MEMORY_TARGET问题
用root登录
1
|
sudo
su
-
|
粘贴下载的代码到命令行,来创建oracle-shm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
cat
>
/etc/init
.d
/oracle-shm
<<-EOF
#! /bin/sh
# /etc/init.d/oracle-shm
#
#
case
"\$1"
in
start)
echo
"Starting script /etc/init.d/oracle-shm"
# Run only once at system startup
if
[ -e
/dev/shm/
.oracle-shm ];
then
echo
"/dev/shm is already mounted, nothing to do"
else
rm
-f
/dev/shm
mkdir
/dev/shm
#mount -B /run/shm /dev/shm
mount
-t tmpfs shmfs -o size=2048m
/dev/shm
touch
/dev/shm/
.oracle-shm
fi
;;
stop)
echo
"Stopping script /etc/init.d/oracle-shm"
echo
"Nothing to do"
;;
*)
echo
"Usage: /etc/init.d/oracle-shm {start|stop}"
exit
1
;;
esac
#
### BEGIN INIT INFO
# Provides: oracle-shm
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Bind /run/shm to /dev/shm at system startup.
# Description: Fix to allow Oracle 11g use AMM.
### END INIT INFO
EOF
|
安装oracle-shm
1
2
|
chmod
755
/etc/init
.d
/oracle-shm
update-rc.d oracle-shm defaults 01 99
|
重启
1
|
reboot
|
5. run the configure
/etc/init.d/oracle-xe configure
Specify the HTTP port that will be used for Oracle Application Express [8080]:8088
Specify a port that will be used for the database listener [1521]: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]:
Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.
6. If you are used to apex and don’t know what an workspace is you first need to access: http://localhost:9090/apex/apex_admin and use admin/[password provided to configure script] to login
7. 增加一个oracle.profile文件,用来验证oracle是可以联通oracle服务器。
# vi oracle.profile
或
# vi /root/.bash_profile
增加以下内容:
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe
export ORACLE_SID=XE
export PATH=$PATH:$ORACLE_HOME/bin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_TERM=xterm
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/user/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
检验是否安装成功
source oracle.profile
sqlplus system/password@localhost:1521/xe
8. for impdb note that this is due to the fact that impdp no longer uses the ORACLE_SID variable.
To fix just use for instance:
impdp system@XE/blabla
… instead of
impdp system/blabla ...
参考:
http://blog.csdn.net/liqiangbaba/article/details/27827821