Jennifer Lin’s Weblog

November 26, 2009

Load excel data into Oracle table in TOAD

Filed under: TOAD — jennyca @ 1:55 pm

- Create table
- Import from Text, Excel or Access

Create table
————
Table TAB (Right Click) => Create table
Schema: RXCANADA
Table Name: “Give table a name”
Click “Load Cols From File” button

Choose “XLS File” radio button
File name to choose by browsing
Click “OK” button
Click “OK” button

Import from Text, Excel or Access
———————————
Right Click
Click “Show Data” => “Next”
Choose “Excel file (*.xls)”
File:
Choose “Treat it as empty field” => “Next”
Source: A – T => “Next” => “Next”

Import Mode:
Choose “Append: add records to the destination table”

Before Import: Choose “Truncate table” => “Execute”

Importing ……

November 24, 2009

养成良好的感恩习惯

Filed under: Life — jennyca @ 11:13 pm

无论是接受谁递送的礼物,都要双手接过来,并大声说谢谢。这里再分享一段我喜欢的话:人在失败中要记得回头,有回头就要学会感恩,有感恩就要记得美丽。永怀感恩的心,学会感激来到这个世上,感激生你养你的父母,感激和你相处的朋友,感激给你发展的事业平台,感激今天至少还幸福地微笑着,那么你会发现原来生命是多么灿烂。为自己预备一本美丽的小簿子《感恩储蓄簿》,随时记下感恩的事情,从最简单的,如清晨的好时光、美味的食物、善良的笑容、温馨的说话,都是上帝送给你的礼物,为此感恩吧。恩典、喜乐会像储蓄一样的,是有者愈有的,当你心烦意闷时拿出来细数,扬声赞美。每天每时刻,珍惜所有生活点滴,高兴欢喜。

http://blog.creaders.net/helen007/user_blog_diary.php?did=51221

November 15, 2009

Red Hat Linux Enterprise 5.0安装oracle11G

Filed under: Installation — jennyca @ 10:42 pm

Linux: OS: Red Hat  Linux Enterprise  5.0

SoftWare:oracle11g

一、检查硬件

1.查看RAM和交换空间以及磁盘大小

命令:#grep MemTotal /proc/meminfo (检查内存大小)

#grep SwapTotal /proc/meminfo (检查交换区大小)

#df -h  (查看磁盘大小)

#df -k /tmp (查看tmp临时文件的大小oracle11G官方文档要求大于80M即可,但是在安装过程中可能要比这大一些)

要求:
所需最小 RAM 为 256MB,而所需最小交换空间为 512M。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。
Oracle 10g 软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要 400MB 的可用空间。

10g官方要求为:最小RAM 为1024MB, SWAP为RAM的2倍。RAM为1025MB~2048MB,SWAP为RAM的1.5倍。RAM为2049MB~8192MB,SWAP与RAM相 等。RAM大于8192MB,SWAP为RAM的0.75倍。/tmp目录至少400MB。安装Oracle 10g软件需1.5GB~3.5GB磁盘空间。Oracle数据库需要1.2GB磁盘空间。

二、验证Linux安装

1、检查内核版本

命令:

#uname -r

所需版本:2.6.18(为官方RHEL 5.0的要求)

2、检查所需软件包

命令:

#rpm -q package-name(红色字体为所需包的名称)
所需包及其版本:

binutils-2.17.50.0.6-2.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125
gcc-4.1.1-52
gcc-c++-4.1.1-52
glibc-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
glibc-headers-2.5-12
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.1-52
libstdc++-4.1.1
libstdc++-devel-4.1.1-52.e15
make-3.81-1.1
sysstat-7.0.0
*******如果有软件包未安装,插入Linux系统安装光盘,使用以下方法安装*******

#rpm -ivh package-name-major-version*

例如:#rpm -Uvh compat-db-4*

注意:(unixODBC-2.2.11.i386.rpm和unixODBC-devel-2.2.11.i386.rpm这两个包虽然 oracle11G官方文档中没有列出但是在实际的安装过程中是需要的,在oracle检测硬件,软件环境及配置信息的时候会提示警告信息以上两个文件没 有找到。以上两个文件可以在网上搜索,也可以在centOS5.ISO文件中找。笔者是偷懒从此镜像文件中拉过来用的。)

三、针对Oracle配置Linux

1、新建组和用户

*以root用户登陆,用户帐户将称为 oracle,而组将称为 oinstall 和 dba。

命令:
# /usr/sbin/groupadd oinstall (创建组)
# /usr/sbin/groupadd dba(创建组)

#/usr/sbin/useradd -g oinstall -G dba /u01/oracle  oracle(创建oracle用户并将其属主改为oinstall和dba)

*设置Oracle用户口令

命令:

passwd oracle

*创建目录

以root用户登陆

命令:
#mkdir -p /u01/oracle (创建目录文件)

#chown -R oracle:oinstall /u01/oracle (将其目录的用户和属主改为oracle和oinstall便于下面的oracle11G的安装)

# id oracle

2、文件脚本创建及编辑

*以root用户登陆,#vi /etc/sysctl.conf在此文件最后添加如下内容:

fs.file-max = 512 * PROCESSES(如果内存在1G以上此行一般可以省略。具体参照oracle11G官方文档)
kernel.shmall = 2097152(脚本文件已经定义了 修改数值即可)
kernel.shmmax = 2147483648(脚本文件已经定义了 修改数值即可)kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
保存完毕后执行下面的命令 使上面的设置有效    # /sbin/sysctl -p*以root用户登陆#vi /etc/security/limits.conf在此文件最后添加一下内容:oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536
(此参数中的oracle可以更换成*,在oracle11G的官方文档中是以oracle开始的,是为了专供oracle用户调用)*以root用户登 陆,#vi /etc/pam.d/login 文件最后添加如下内容:session    required     /lib/security/pam_limits.sosession    required     pam_limits.so*以root用户登陆在#vi /etc/profile 文件最后添加以下内容:if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
四、设置环境变量 —以oracle登录*切换到oracle用户下修改其环境变量:#su – oracle#vi .bash_profile在此文件最后加入以下内容:    ORACLE_BASE=/u01    ORACLE_HOME=$ORACLE_BASE/oracle    ORACLE_SID=WCHDB1(随便起名但是一定要和安装软件中的sid对应一致)    PATH=$ORACLE_HOME/bin:$PATH    export ORACLE_BASE ORACLE_SID ORACLE_HOME PATH保存完毕后用#env |grep ora查看配置的环境变量是否正确。*将oracle11G软件包解压缩:*如果是filename.cpio.gz此类文件用以下命令进行解 压:#gunzip filename.cpio.gz
#cpio -idcmv < filename.cpio然后得到database文件。*如果是file_name.zip文件,用以下命令进行解压:
#unzip filename.zip
解压后得到database文件。得到database文件后mv(移到)到/u01目录下,并将database文件的用户和属主更改为oracle和 oinstall#chown -R oracle:oinstall database到此为止linux的环境已经都部署完毕,接下来就是oracle11G的安装。五、 安装在安装oracle11g的机子上用oracle登录到图形界面打开命令终端运行:#cd /u01/database#./runInstaller然后就会出现提示对话框,更具提示一路next接可以了!(因为安装oracle数据库要弹出 图形界面对话框所以必须登陆图形界面。等安装完毕后推出图形界面,便于节省资源!) 安装完毕后再创建数据库。

http://www.boobooke.com/bbs/viewthread.php?tid=19502&extra=page%3D1

合理安排任务,有效利用时间

Filed under: English — jennyca @ 10:38 pm

生活中常常遇到这样的情况,事情一下子冲击过来,压力倍增,这时恨不得能有分身术。那到底该怎样安排任务充分利用时间呢?Take on Tasks One at a Time
一次一个任务
We think we are reducing stress by accomplishing more than one thing at a time, when in fact, we are causing ourselves more stress than ever. Stress-busting tip: leave multitasking to your personal computer. Do one thing at a time, do it well, and move on to the next item on your list. That’s the best way to regain a sense of control over time.

我们自认为同时做几件事可以减轻压力,但事实上,我们是给自己增加更多压力。减压秘诀:在多项任务在你的电脑上列出。每次只做一件事并且把它做好,然后再去做清单上的下一件事。这时你会感觉到自己又能重新掌控时间了。

Make an Effort to Do Less
努力少做些事
Think for a moment about where in your life you are spending valuable time on something that you could possibly live without. Think about getting away from the TV and computer screens that are mental vampires, sucking the life out of us by stealing our time and attention. By doing less and by carefully choosing which activities give you the least amount of benefit for the time commitment they require, you’ll actually end up creating more time in your day.
仔细想一下:你的一生中把多少宝贵的时间花在那些就算没有你也能活下去的事 情上。不妨考虑一下远离诸如电视和电脑等等。它们是精神吸血鬼,偷取了我们的时间和精力,吸干了我们的生命。少做些这样的事,权衡下再选择那些能使你在一 定的时间内获益最多的活动,那么你就在一天中创造更多的时间了。

Scale Down Your Priorities
按优先级逐级做事
Make a list of four things that you would like to accomplish today. Keep the list with you and stay with each item until you have completed it. Then go to the next item on your list and repeat the process. Keep doing this until you’ve gotten to the end of your list. Most of us place overwhelming demands on ourselves, or we expect far too little of ourselves. The goal is to hit the “sweet spot,” where our expectations of what we can accomplish in any given 24-hour period are in line with reality. If you’re afraid that you won’t accomplish all four things, well, that’s why they invented tomorrow!
列一个清单,上面包括你今天要完成的四件事。把这份清单 带在身上,每完成一个项目,就划掉。然后继续清单上的下一个项目并重复以上过程。持续这样直到你把清单上的所有项目都完成。我们大多数人都对自己要求太 多,或者对自己期望太低。我们的目标就是达到“甜蜜点”:现实中我们做到了期望中的在24小时内完成的事。如果你害怕自己完成不了所有的事的话,这就是明 天之所以存在的原因了。

Clear Out the Clutter
清除杂物
When our homes, our workplaces, and our vehicles have a sense of orderliness to them, we actually feel more peaceful and less stressed out. We’ve all gone through the agony of trying to rush out the door when we can’t find our car keys, wallet, or purse! Keeping your personal space clutter-free makes it easier to manage your time when you’re in a hurry.
当我们的家庭,工作环境和汽车都整齐有序时,我们会感到更平和,压力也会更小点。我们都经历过找不到汽车钥匙,皮夹或钱包时想奔出门的痛苦。把个人空间弄得整齐一点,这可以让你在忙乱之中更好地掌握自己的时间。

Replenish Your Body with Rest
注意休息
Most of us constantly have our fingers on the fast-forward button, when we really need to hit the pause button for a while. Every time we add another activity or responsibility to our lives, we generally take the time for that activity out of our sleep. We can only carry on not sleeping enough for a while before it catches up with us, causing all sorts of health disorders, including a terrible sense of frustration and stress.
当我们确实需要休息片刻的时候,我们中的大多数都在快速前进中。每次我们生活中增加了一个新任务或责任时,我们通常会为了完成它而不惜牺牲自己的睡眠时间。在完成之前,我们总是少睡觉也要把它们尽力完成。结果,导致了各种健康紊乱,其中就包括严重的沮丧感和压力。
Learn about the most common sleep thieves and discover strategies for getting the good night’s sleep you deserve.
向那些一下常见的偸睡者学习下吧,寻找一些方法使自己获得应有的睡眠吧。

Think Positively About Time
积极乐观地看待时间
We all know how weeds can overtake a garden, so it is our job constantly to notice and uproot any negative thoughts in the garden that is our mind. As a result, positive thoughts can take root, bloom, and create the beauty that we need in order to enjoy our lives to the fullest. If you hear yourself saying, “I don’t have enough time,” then say, and preferably out loud, “I have all the time I need for all the things I need to do.” A declaration like that has a relaxing and liberating effect on every cell in your body, which relieves tension.
我们都知道种子是 如何成长为一片花园,所以我们的工作就是不断地发现并连根拔起我们心灵花园中负面的思想。这样,积极的思想能够生根,发芽并创造出我们所需的美丽,从而我 们能充分的享受生活。如果你听到自己说,“我没足够的时间,”然后,大声说出,“我有足够的时间做我需要做的事!”这样的一种宣告可以放松并解放你体内的 每一个细胞,从而缓和压力。

http://www.24en.com/fun/soul/2009-11-02/113830.html

学英语要像练武术一样

Filed under: English — jennyca @ 10:34 pm

True mastery of any skill takes a lifetime.
对任何技能的掌握都需要一生的刻苦操练。
中国的每一人几乎都看过很多武打片,武打片里几乎都有同样的故事:全家被杀,走头无路,躲进深山,苦练武功。冬练三九、夏练三伏,君子报仇十年不晚!最 后,成功复仇,故事圆满结束。每次我看武打片最感兴趣的就是他们整个自我锻造的过程。苦练基本功,一招一式都仔细揣摩,反复操练,直至出神入化。这和学英 语是完全一个道理!
回想我的一生,有很多这样的经历。我曾经约同学一起在一棵大苹果树上练了两个多月英语。我们躲在茂密的树里面,坐在树叉上,闻着苹果树香,忘记外面精彩的时间,彻底安静下来,一心想着一口流利的英语。由于每天都能从树中传出喊英语的声音,人们把这棵树叫英语树!
亲爱的朋友们,请打印或抄下下面这段精彩文章,找个公园或风景秀丽的地方,去疯狂操练吧!带上家人和朋友,共享快乐成长时光!
The only way to master a marital art is to practice each move over an over until you can perform it precisely. It takes the same dedicated effort and practice to become a fluent English speaker.

The only way to ever really master English is to practice each word, each syllable and each individual sound until you can pronounce it exactly right. There is no shortcut to becoming a master.

True mastery of any skill takes a lifetime.

http://www.veryen.org/html/pinpaiyingyu/fengkuangyingyu/2009/1020/3205.html

November 5, 2009

SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

Filed under: ORA Errors — jennyca @ 4:28 pm

When execute ’sqlplus’ as a user outside of the dba or Oracle group, you get the following errors.

Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

Syntax:
$ sqlplus username/password

This problem did not occur in previous releases of Oracle.

Similar problems occur with other client tools, like IMP, EXP, etc.

Cause

The files that sqlplus needs to execute do not have read/execute permissions on the O/S level.

Solution

There is a one-off patch for the base bug 4516865, but this fixes the permissions problem only on the server side. Only for Linux, this patch includes fix for both server and client side (Bug 4747264).  Patch 4516865 provides a script called changePerm.sh. Since 10.2.0.2, the changperm.sh script is included in all patchsets and is documented in the patchset README.

At the time this note was written, there was no patch for the client side for platforms other than Linux.   However, there are a couple of workarounds:

I.  Logged in as the Oracle user (or the user that installed the 10gR2 software), manually change the permissions on the client.  For example:

chmod -R 755 <client_home>

In our case:

chmod -R 755 $ORACLE_HOME/sqlplus

II.  If doing a recursive permissions command is not acceptable, then you will need to pinpoint exactly what files the client is reading at the time of execution, and manually change permissions only on those files.  In our case, we need to pinpoint what files are being accessed by SQL*Plus.   To implement this workaround, please execute the following steps:

1. As the non-Oracle user, run the truss utility to find out which files are being accessed.  Sample command:
truss -aefo /tmp/truss_sqlplus.out sqlplus username/password

2. Use this truss_sqlplus.out trace file to see what files have error “EACCES” when attempting to access.   In our case, the truss_sqlplus.out showed a problem accessing the following file:
$ORACLE_HOME/sqlplus/mesg/sp1us.msb

Another possible error to search for in the truss output is ENOENT.  For example:
9775: open(“./sqlplus/mesg/sp1us.msb”, O_RDONLY) Err#2 ENOENT

3. Logged in as the Oracle user, change permissions on folders leading up to, and including sp1us.msb:

chmod 755 $ORACLE_HOME/sqlplus
chmod 755 $ORACLE_HOME/sqlplus/mesg
chmod 755 $ORACLE_HOME/sqlplus/mesg/sp1us.msb

4. After making above permission changes, a different error may appear when executing sqlplus as non-Oracle user, such as:

$ sqlplus username/password
SP2-1503: Unable to initialize Oracle call interface
SP2-0152: ORACLE may not be functioning properly
$

5. At this point, you need to re-run the truss (as non-Oracle) to see what other files are trying to be accessed.  In our case, the following files were trying to get accessed, but showed “EACCES” failure:

$ORACLE_HOME/nls/data/lx1boot.nlb
$ORACLE_HOME/oracore/zoneinfo/timezlrg.dat

6. Logged in as the Oracle user, change permissions on these files and the directories leading up to these files.

chmod 755 $ORACLE_HOME/nls
chmod 755 $ORACLE_HOME/nls/data
chmod 755 $ORACLE_HOME/nls/data/lx1boot.nlb
chmod 755 $ORACLE_HOME/oracore
chmod 755 $ORACLE_HOME/oracore/zoneinfo
chmod 755 $ORACLE_HOME/oracore/zoneinfo/timezlrg.dat

7. Now, invoking sqlplus as a non-Oracle user was successful in our case.

Blog at WordPress.com.