2007年6月27日星期三

linux 下oracle10g 的安装

Installing Oracle 10g R2 on Ubuntu Edgy


  1. Login to ubuntu from your usual administrative account which has sudo access
  2. Make sure you have enough ram, swap space and disk space as per oracle requirements.
  3. Install the required packages (first make sure ‘universe’ is enabled in your sources.list):
    • sudo apt-get install build-essential libaio rpm lesstif2-dev alien
  4. Create the users and groups oracle needs:
    • sudo groupadd oinstall
    • sudo groupadd dba
    • sudo groupadd nobody
    • sudo useradd -g oinstall -G dba,nobody -d /opt/oracle -s /bin/bash oracle
  5. Set oracle user’s password
    • sudo passwd oracle
  6. Create the directory for the software installation and assign ownership to oracle:oinstall
    • sudo mkdir /opt/oracle
    • sudo chown -R oracle:oinstall /opt/oracle
    • sudo chmod -R 775 /opt/oracle
  7. In another console, login as oracle to make sure it works fine, then logout.
  8. Append user oracle’s .bashrc with PATH and ORACLE:BASE,HOME and SID information
    • sudo vi /opt/oracle/.bashrc
    • export ORACLE_BASE=/opt/oracle
    • export ORACLE_HOME=$ORACLE_BASE/product/10gR2
    • export ORACLE_SID=orcl
    • export PATH=$PATH:$ORACLE_HOME/bin
  9. Make sure the correct kernel parmeters are appended to /etc/sysctl.conf
    • kernel.shmall = 2097152
    • kernel.shmmax = 2147483648
    • kernel.shmmni = 4096
    • kernel.sem = 250 32000 100 128
    • net.core.rmem_default = 262144
    • net.core.rmem_max = 262144
    • net.core.wmem_default = 262144
    • net.core.wmem_max = 262144
    • fs.file-max = 65536
    • net.ipv4.ip_local_port_range = 1024 65000
  10. Set the kernel parameters or reboot
    • /sbin/sysctl -p
  11. Set /etc/security/limits.conf
    • * soft nproc 2047
    • * hard nproc 16384
    • * soft nofile 1024
    • * hard nofile 65536
  12. Create symbolic links and camoflage Kubuntu to look more like an enterprise rpm based distro because the oracle installer is expecting rhel, sles or asianux based distros.
    • sudo ln -s /usr/bin/awk /bin/awk
    • sudo ln -s /usr/bin/rpm /bin/rpm
    • sudo ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
    • sudo ln -s /usr/bin/basename /bin/basename
  13. Mount the Oracle10g CD and run the installer
    • /runInstaller -ignoreSysPrereqs
  14. Installation will be uneventful provided above steps are followed
  15. Enable the oracle user to dbshut, dbstart and lsnrctl start
    • sudo vi /etc/oratab and change :N to :Y

All Done!


Oracle 10g Enterprise / Standard Edition on Ubuntu 5.10 Breezy

2007年6月26日星期二

/etc/init.d/oracle

oracle/product/10.2.0/db_1/bin/dbstart
ORACLE_HOME_LISTNER=/home/oracle/oracle/product/10.2.0/db_1

/etc/oratab
orcl:/home/oracle/oracle/product/10.2.0/db_1:Y

.bashrc
ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
ORACLE_SID=orcl
#ORACLE_BASE=~/oracle/product

PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export PATH
export ORACLE_SID

/etc/init.d/oracle

#!/bin/bash
#
# /etc/init.d/dbora
#
# Startup script for Oracle databases

export ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1/
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin

case "$1" in
start)
echo -n "Starting Oracle: "
su oracle -c $ORACLE_HOME/bin/dbstart
touch /var/lock/oracle

su oracle -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
stop)
echo -n "Shutdown Oracle: "
su oracle -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/oracle
echo "OK"
;;
*)
echo "Usage: 'basename $0' start|stop"
exit 1
esac
exit 0

2007年6月25日星期一

2007年6月19日星期二

Linux All-in-One Desk Reference For Dummies, 2nd Edition

Linux All-in-One Desk Reference For Dummies, 2nd Edition

book1: linux basics

CD/DVD刻录: cdrecord/growisofs
1. 运行cdrecord-scanbus,查看输出,判断刻录机的参数
2. 进入ISO所在目录
3. ls -l 查看ISO文件名
4. 将空白光盘插入刻录机
5. # cdrecord -v -pad speed=1 dev=0,0,0(刻录机的参数) filename.iso
6. # growisofs -dvd-compat -Z /dev/scd0=filename.iso

创建X配置文件
X -configure
测试生成的配置文件
X -config ///etc/xorg.conf.new
使配置文件生效
cp ///etc/xorg.config.new /etc/X11/xorg.conf

book2: Linux Desktops

http://www.freedesktop.org/wiki/Desktops

command > file #标准输出重定向
command 2> file #错误输出重定向
command > file 2>&1 #输出重定向
command <> file.out
command >> file #追加
command 2>> file
command >> file 2>&1
command <&1 command2 #将输出输入置command2

对文件内容排序
sort /etc/password > sorted.text
删除或替换字符
tr
tr -d '\015' <> filename.lin
文档切分
split -b 1440k hugefile.tar part.
合并
cat part.?? > hugefile.tar


VI
!command #执行外部命令
$ #移到文档尾部
%
+ # 下一行
+n
- #上一行
-n
.
/text/
Q #不存盘退出
r file #插入外部文档
W file #将内容另存到文件尾部
w file #另存
/string #向前搜索
?string #向后搜索


book3: networking

查看网络接口: /sbin/ifconfig
查看路由表: /sbin/route
查看网络状态: netstat -i
抓取数据包: tcpdump -a -c 1000 > tdout

book4: Internet

book5: administration
监控系统性能
top/uptime/vmstat
监控磁盘性能与空间
/sbin/hdparm -t /dev/hda
dh
查看系统信息
/proc/cpuinfo
...
lsmod
modprobe snd-card-0
modprobe -r snd-card-0
/etc/modprobe.conf
/etc/at.allow /etc/at.deny 可以使用at 的用户列表
/etc/cron.allow /etc/cron.deny



book6: security
密码安全
/etc/passwd => /etc/shadow
密码有效期
chage -l root
GPG
Tripwire
TCP wrapper ==> /etc/hosts.deny /etc/hosts.allow fi
iptables-restore < iptables.rules
securitytools: nmap/nessus
xinetd与inetd

book7:internet servers
apache/vsftp/dns/nfs/samba

2007年6月7日星期四

Debian 安装备忘

1. apt-get install xserver-xorg-core kde-core xfonts-base xfonts-100dpi xfont-75dpi xfonts-scalable

2. 安装fcitx

apt-get install fcitx im-switch
配置
im-switch -s fcitx
如果是英文环境 需要设置LC_CTYPE=zh_CN.UTF-8

手动添加/etc/X11/Xsession.d/nnxinput 文件 (nn为数字)

export XMODIFIERS="@im=fcitx"
export XIM=fcitx
export XIM_PROGRAM=fcitx
export GTK_IM_MODULE="XIM"
export QT_IM_MODULE="XIM"
fcitx

3.时间
tzselect
ntpdate asia.pool.ntp.org >> /dev/null

4.sudo
#apt-get install sudo
tony ALL=(ALL) NOPASSWD:ALL

5.PDF 阅读器
$sudo aptitude install xpdf-chinese-simplified xpdf-reader evince

6. MP3播放器
$ sudo aptitude install alsa-base alsa-utils beep-media-player
$sudo alsaconf

7. 安装office
安装永中office
无法驱动打印机, 据说是cups 版本太高

8. 安装vmware
insmod 错误, module-init-tools(3.3-pre11-1)的bug 降级使用(3.3-pre4-2)

9.安装RSS阅读器
liferea


...
明天继续

静态页面-2006-05-27

http://www.flashnet.cn/bbs/dispbbs.asp?boardid=33&ID=553&replyID=553





为了减轻服务器压力,将原来的文章管理系统由JSP文件的从数据库中取数据显示改为由jsp生成静态html文件后直接访问html文件。下面是一个简单的示例


1.buildhtml.jsp


<%@ page contentType="text/html; charset=gb2312" import="java.util.*,java.io.*"%>

<%

try{

String title="This is Title";String content="This is Content Area";

String editer="LaoMao";

String filePath = "";

filePath = request.getRealPath("/")+"test/template.htm";

//out.print(filePath+"<br>");

String templateContent="";

FileInputStream fileinputstream = new FileInputStream(filePath);//读取模块文件

int lenght = fileinputstream.available();

byte bytes[] = new byte[lenght];

fileinputstream.read(bytes);

fileinputstream.close();

templateContent = new String(bytes);

//out.print(templateContent);

templateContent=templateContent.replaceAll("###title###",title);

templateContent=templateContent.replaceAll("###content###",content);

templateContent=templateContent.replaceAll("###author###",editer);// 替换掉模块中相应的地方

//out.print(templateContent);

// 根据时间得文件名

Calendar calendar = Calendar.getInstance();

String fileame = String.valueOf(calendar.getTimeInMillis()) +".html";

fileame = request.getRealPath("/")+fileame;//生成的html文件保存路径

FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件输出流

byte tag_bytes[] = templateContent.getBytes();

fileoutputstream.write(tag_bytes);

fileoutputstream.close();

}

catch(Exception e){

out.print(e.toString());

}


%>


2. template.htm


<html>

<head>

<title>###title###</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<LINK href="../css.css" rel=stylesheet type=text/css>

</head>


<body>

<table width="500" border="0" align="center" cellpadding="0" cellspacing="2">


<tr>


<td align="center">###title###</td>


</tr>


<tr>


<td align="center">author:###author###&nbsp;&nbsp; </td>


</tr>


<tr>


<td>###content###

</td>




</tr>


</table>

</body>

</html>

oracle资料备份

# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
GZJS_192.168.102.200 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.102.200)(PORT = 1521))
)
(CONNECT_DATA =
(SID = gzjs)
(SERVER = DEDICATED)
)
)
JLXT_192.168.201.2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.201.2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = jlxt)
(SERVER = DEDICATED)
)
)

系统升级错误-2006-11-23

W: There are no public key available for the following key IDs:
A70DAF536070D3A1
W: You may want to run apt-get update to correct these problems
# gpg --keyserver wwwkeys.eu.pgp.net --recv-keys A70DAF536070D3A1 && gpg --armor --export A70DAF536070D3A1 | apt-key add -
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: requesting key 6070D3A1 from hkp server wwwkeys.eu.pgp.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 6070D3A1: public key "Debian Archive Automatic Signing Key (4.0/etch) " imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1
OK

装hp1022n打印机-2006-11-28

OS : Debian/etch
Printer : HP laserJet 1022n/network
$ sudo aptitude install hplip hplip-base hplip-data hplip-ppds cupsys-client cupsys foomatic-db-hpijs hpijs
$ sudo hp-setup
http://hplip.sourceforge.net/install/step1/apt.html

oracle客户端安装备忘-2006-12-06

安装备忘 OS: CentOS 4.3

oracle: 9.2.0.1.0

安装客户端

需要安装以下包:make compat-db compat-gcc-32 compat-gcc-32-c++ compat-oracle-rhel4 compat-libcwait compat-libgcc-296compat-libstdc++-296 compat-libstdc++-33 gcc gcc-c++ gnome-libs gnome-libs-devel libaio-devel libaio make openmotif21 xorg-x11-deprecated-libs-devel xorg-x11-deprecated-libs

更新以下包:up2date gnome-libs gnome-libs-devel

设置以下变量:export LD_ASSUME_KERNEL=2.4.19

可以在以下网站下载光盘上未提供的软件包:http://oss.oracle.com/projects/compat-oracle/files/RedHat/

如�
��出现以下错误:

DllGroup = false

Calling action unixActions2.2.0.6.0 createLink
source = /opt/ora9/jre/1.1.8/bin/.java_wrapper
destination = /opt/ora9/jre/1.1.8/bin/jre
overwriteExistingLink = true

则可能是 $LD_ASSUME_KERNEL 变量没有设置



参考文档:
http://www.puschitz.com/InstallingOracle9i.shtml

Oracle学习笔记-2007-01-17

1. 查看归档状态
>select log_mode from v$database;
>archive log list ;

2. 切换归档状态
>shutdown immediate;
>startup mount;
>alter database archivelog(noarchivelog)
>alter database open;
>archive log list;
3. 应用pfile修改
>create pfile from spfile
修改pfile(:\oracle\product\10.1.0\Db_1\database\INITtonydb.ORA)
>create spfile from pfile
or
>show all(parameters parametername)
>alter system set parameter=valuse;
4. 指定 pfile 启动
>shutdown immediate;
>startup pfile="";
5. 手动归档
>archive log all;
6. 数据库冷备份
备份
>select name from v$datafile;
%
09>shutdown immediate;
>$copy ... 复制目标文件
>startup;
恢复
恢复数据库的唯一方法是,从冷备份文件中恢复所有数据库文件,以使数据库处于一致状态
7. 数据库热备份
备份
>alter tablespace system begin backup;
>$copy ...
>alter tablespace system end backup;
恢复
>alter database datafile 'D:\ORACLE\PRODUCT\10.1.0\ORADATA\TONYDB\SYSTEM01.DBF' offline;
>alter database open;
>$copy ...
>recover datafile 'D:\ORACLE\PRODUCT\10.1.0\ORADATA\TONYDB\SYSTEM01.DBF'
>alter database datafile 'D:\ORACLE\PRODUCT\10.1.0\ORADATA\TONYDB\SYSTEM01.DBF' online;
>alter database open
8. 分析备份文件的可用性
F:\>dbv file=f:\SYSTEM01.DBF blocksize=8192
9. 控制文件备份
> alter database backup controlfile to trace;
==
> D:\oracle\product\10.1.0\admin\tonydb\udump\tonydb_ora_xxxx.trc
10. 表空间状态的切换
> alter tablespace read only;
> alter tablespace read write;
11. 数据库不完整恢复
基于取消
>startup mount;
>recover database until cancel;
基于时间
>startup mount;
>recover database until time '2000-01-01:01:01:01';//YYYY-MM-DD:HH:MI:SS
12. RMAN
cmd> rman
RMAN> connect target / //与默认目标数据库建立连接
RMAN> show all;
RMAN> configure retention policy clear; //恢复默认设置
13. RMAN backup
RMAN> report need backup;
RMAN> run {
allocate channel c1 type disk; //信道名和设备类型
backup full //备份类型
format 'd:\backup\%d_%p_%t' //文件格式
(tablespace system //备份对象
include current controlfile);} //备份对象
注: backup {full|incremental level=n|archivelog all|database} //archivelog
backup {database} //noarchivelog
14. RMAN 使用copy 备份
RMAN> run{
allocate channel c1 type disk;
copy level 0
datafile 1 to 'd:\2222\systemimg.dbf';} //4 指定文件, 可以使用 report schema 获取
15. RMAN restore
RMAN> run {
allocate channel c1 type disk;
restore database;
recover database;
}
16. RMAN 不完整恢复
基于时间
RMAN> run {
allocate channel c1 type disk;
set until time 'DD MON YYYY HH: MI: SS';
restore database;
recover database;
}
17. RMAN 维护
RMAN> crosscheck backup of database;
RMAN> crosscheck copy of database;
RMAN> list backup of database;
RMAN> list copy of database;
RMAN> change backupset i {unavailable|unavailable};
18. exp 与 imp
19. SQL*Loader
20. 服务器配置
.\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\listener.ora
SID_LIST_LISTENER = //指定侦听SID, 指定监听服务器列表
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\product\10.1.0\Db_1)
(PROGRAM = extproc)
)
)
LISTENER = //LISTENER定义
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = TONYBOX)(PORT = 1521))
)
21. 客户端配置
.\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\sqlnet.ora

有关xwindows的三个命令-2007-01-29

$ xgamma
-> Red 1.000, Green 1.000, Blue 1.000
# xgamma -gamma 1.300
# xvidtune
# xrandr -q
# xrandr -s 1280 x 102 -r 75

重装系统-2007-02-02

重装系统 tnnd

2.6.17 以上内核均不能上网, 但是能ping通, 也不是都不能上, 比如google就可以

debian的sarge 又不能识别sata的硬盘 郁闷


解决:

# echo 0 > /proc/sys/net/ipv4/
tcp_window_scaling
or

编辑
/etc/sysctl.conf 文件, 加入如下行:

net.ipv4.tcp_window_scaling=0

http://lwn.net/Articles/92727/

2007年6月5日星期二

烟雨迷蒙游扬州

DSC00190

DSC00196

DSC00197

DSC00198

DSC00208

DSC00221
DSC00226

DSC00235

DSC00227

身体终于好了

身体终于好了, 经历了将近2个周到不爽

结果搞的去江苏出差都没有吃好, 也没有玩好,

那饭菜, 现在想想都流口水啊, 可是当时一点胃口都没有

很是不爽啊

稍后附上照片