Jennifer Lin’s Weblog

May 28, 2008

修改了监听端口, 怎样保证 DB Control 正常运行

Filed under: Oracle DBA — jennyca @ 10:38 pm
1. 修改 listener.ora 和tnsnames.ora 这两个文件:
tnsnames.ora 中需要加入:

listener_1 =
(ADDRESS = (PROTOCOL = TCP)
(HOST = xxxx)(PORT = 新的端口))

然后启动数据库:
SQL> show parameter local_listener ;
SQL> alter system set local_listener=’listener_1′ scope=spfile;

重启数据库使得修改生效

2. 修改 $ORACLE_HOME\hostname_sid\sysman\config
下的emoms.properties文件:

oracle.sysman.eml.mntr.emdRepPort=新的端口
oracle.sysman.eml.mntr.emdRepConnectDescriptor =(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=xxx)(PORT\= 新的端口)))(CONNECT_DATA\=(SERVICE_NAME\=xxx)))

3. 最后,还要修改 $ORACLE_HOME\hostname_sid\sysman\emd
下的targets.xml:
<Property NAME=”Port” VALUE=”新的端口”/>

4. 重新启动监听器和dbconsole 服务.

5. 如果嫌上面的操作麻烦,可以用emca这个命令行工具:
emca -h 查看所有可用的命令
emca -r 跳过资料档案库的创建

Linux下oracle启动脚本DBSTART和DBSHUT需要修改的地方

Filed under: UNIX/LINUX — jennyca @ 10:37 pm

系统环境:Redhat Linux 9 + Oracle9.2.0.1

Linux 系统下安装完数据库之后,会在$ORACLE_HOME/bin 下生成 dbstart dnshut 脚本,这两个脚本可以简便地实现启动和关闭数据库。这两个脚本运行时会读取/etc/oratab 文件,在这个文件里指定了需要启动和关闭的 SID(相 SID 那行的最后一个字符是 Y 而不是 N

DBSHUT 的问题:

默认是执行 shutdown 而不是 shutdown immediate,这样当有别的 client 连着的时候,数据库不会 shutdown,可以把该脚本执行 shutdown 的部分改成 shutdown immediate,当然是不是需要这样强行切断用户连接,rollback 所有未 commit transaction,还需要看自己的需求了。

DBSTART 问题:

执行时会检查在$ORACLE_HOME/dbs 中有没有 initSID.ora 文件,如果没有则报错退出。但是安装 9i 的时候通常会使用 spfile,所以在此目录下是不会存在 initSID.ora 文件的。

修改的方法有两个:

一是改脚本,在 else 后面加判是否存在 spfile,如果有继续,没有再报错,但是此方法比较麻

二是创建一个 pfile,用 create pfile=pfilepath from spfile=spfilepath 就可以了,此命令在数据库 instance 没有启动的情况下也可以执行。

Auto File Transfer Via FTP Batch Scripts In Both Windows And Linux

Filed under: Others — jennyca @ 10:30 pm

可以把FTP写到shell脚本中,如
ftp -n -i 主机IP <<EOF
user username pass
cd 目标目录
put file
get file
#查询文件
ls
#退出
bye
EOF

How to automate file transfer via ftp client in Windows XP / Windows Vista?

  1. Create ftp command template file with these sample command and give it a meaningful file name, e.g. walker-ftp.tpl
    open ftp.walkernews.net
    user walker-login-id-here
    walker-login-password-here
    prompt
    mget *.*
    by

    Understand the ftp command template:

    • use the mandatory keyword open to specify the target computer that the ftp client connect (open) to, e.g. ftp.walkernews.net
    • use the mandatory keyword user to specify the user ID to login the ftp server
    • specify the password used to authenticate the user login ID specify in step (b)
    • assuming login to ftp server is successful, this step onwards are the normal ftp client compatible commands.For example, type ftp at Command Prompt and type help at the ftp prompt will display all the ftp client compatible commands. To get further help description of each ftp client command, type help command, e.g. help promptThe prompt keyword is use to turn on (default) or turn off interactive prompting on multiple commands. For example, if you don’t want to answer Y or N when execute mput or mget command. Essentially, it’s identical to explicitly specify -i option switch to the ftp client.

      You can type ftp -? at Windows Command Prompt for more ftp client option switches.

    • The mget *.* ftp command is to get / download all files in the target directory on remote ftp server to the working directory of the local computer.
    • at last, execute by or bye command to end or terminate current ftp connection.
  2. Now, you can type this single command to instruct Windows ftp client program to automate file transfer /downloading with all the ftp commands specify in the template.ftp -n -s:walker-ftp.tplYou can either run it at Command Prompt window, or create a ftp batch scripts (Windows batch file) for the command – just double-click the ftp batch file to execute!

There are equivalent implementation in Linux / Unix too, but the syntax is quite different. So, let’s see how to create a Linux scripts to automate file transfer with FTP client in Redhat Enterprise4.

  1. In the user home directory, create a hidden file called .netrc that contains these auto-ftp commands
    machine 10.1.1.10
    login walker-login-id-here
    password walker-login-password-here
    macdef init
    prompt
    mget *.*
    quit
    Leave one mandatory blank line here
    Leave one mandatory blank line here
    
    machine ftp.walkernews.net
    login walker-login-id-here
    password walker-login-password-here
    macdef init
    pwd
    quit
    Leave one mandatory blank line here
    Leave one mandatory blank line here

    Understand the .netrc file content

    • the keyword machine is used to specify the target ftp host that the ftp client connect to
    • the keyword login is used to specify the user login ID
    • the keyword password is used to specify the password used to authenticate the user login ID
    • the keyword macdef init is used to define the auto-ftp macro command that named as init (refer to man netrc for more information)
    • supposed the login authentication is successful, then the rest of lines after macdec init down to quit keyword are ftp client commands. The quit is identical to the bye command.
    • after the quit keyword, press ENTER twice to leave two empty lines! These two lines are mandatory syntax of .netrc file for auto-ftp. As of this .netrc sample file, I’ve another ftp server added right after the first two empty lines, and end the second ftp server with another two empty lines as well.
  2. Execute chmod 600 .netrc to limit only read and write permission for the login user ownership only. This is a must in order ftp client to automate file transfer!
  3. Now, if you want to auto-ftp with ftp host 10.1.1.10, just type this commandftp 10.1.1.10and the Linux ftp client will automatically execute the series of ftp commands in .netrc file for the matching ftp host.

    Similarly, you can type ftp ftp.walkernews.net for auto-ftp file transfer with the second ftp host.

http://www.walkernews.net/2007/05/08/auto-file-transfer-via-ftp-batch-scripts/

怎么样生成日期格式的文件

Filed under: Others — jennyca @ 10:22 pm

在LINUX/UNIX上,使用`date +%y%m%d` (`这个是键盘上~所在的那个键) 或$(date +%y%m%d),如:


touch exp_table_name_`date +%y%m%d`.dmp
DATE=$(date +%y%m%d)
或者
DATE=$(date +%Y%m%d –date ‘1 days ago’) #获取昨天或多天前的日期

Windows上,使用%date:~4,10%,其中4是开始字符,10是提取长度,表示从date生成的日期中,提取从4开始长度是10的串。你可以改成其它你需要的数字,如:
Echo %date:~4,10%

如果想得到更精确的时间,win上面还可以使用time

ORA-00257

Filed under: ORA Errors — jennyca @ 6:23 pm

从Oracle9i开始,借助于UNDO日志文件提供了闪回查询的功能,由于功能也有一定的局限性,也就是说依赖于UNDO日志的事务不能被覆盖,所以在 Oracle10g开始又采用了一种新的FlashBack日志来实现这个功能,而且更为强大,可以将数据库退回到过去某个时间点去。这个文件默认最大为 2g。但是在一段时间过后,很快就达到了2G,这个时候就会出现ORA-00257错误了。

两种解决方法:

第一种 就是关闭闪回日志的功能,这种对于开发环境中不失为一种好方法,因为开发环境中,并不追求数据的可安全性什么的。通过如下语句改变。
alter database flashback off

SQL> conn / as sysdba
Connected.
SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  373293056 bytes
Fixed Size                  1290664 bytes
Variable Size             348130904 bytes
Database Buffers           16777216 bytes
Redo Buffers                7094272 bytes
Database mounted.
SQL> alter database flashback off;
Database altered.

SQL> alter database open;
Database altered.

SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
NO

第二种 方法就是增大闪回日志文件的最大大小。如下
alter system set DB_RECOVERY_FILE_DEST_SIZE=10g
这个时候,你可以去查看v$flash_recovery_area_usage视图中的使用率情况,这个时候发现使用率(PERCENT_SPACE_USED列的值)已经大大降低了。再通过如下语句去查看系统日志文件情况。

select * from v$log
会发现现在redo日志文件也可以正常写入,至此问题解决。

http://blog.chinaunix.net/u/26381/showart_373304.html

May 27, 2008

SELECT

Filed under: SQL — jennyca @ 4:03 pm

START WITH Clause

Specify a condition that identifies the row(s) to be used as the root(s) of a hierarchical query. Oracle Database uses as root(s) all rows that satisfy this condition. If you omit this clause, then the database uses all rows in the table as root rows. The START WITH condition can contain a subquery, but it cannot contain a scalar subquery expression.

CONNECT BY Clause

Specify a condition that identifies the relationship between parent rows and child rows of the hierarchy. The connect_by_condition can be any condition as described in Chapter 7, “Conditions”. However, it must use the PRIOR operator to refer to the parent row.

Restriction on the CONNECT BY Clause The connect_by_condition cannot contain a regular subquery or a scalar subquery expression.

May 23, 2008

About deed

Filed under: Life — jennyca @ 6:00 pm

http://www.mpalacio.com/glosary.shtml

Deed (Certificate of Ownership)
The document signed by the seller transferring ownership of the home to the purchaser. This document is then registered against the title to the property as evidence of the purchaser’s ownership of the property.

TITLE SEARCH - a search, is a history of ownership of the property you are purchasing. The title search, to insure that you have good and marketable title,  is conducted at the Registry of Deeds and establishes that  the Vendor is the true undisputed owner of the property and to ascertain whether or not there are any problems which may or may not affect the validity of the title to the property you are purchasing. Once clear title is obtained,  the closing of the property proceeds and you receive a deed from the Vendor which conveys the property to the Purchaser.

On closing day, your lawyer will meet a representative from the vendor’s law firm at the land registry office. There, your cheque will be exchanged for the keys to your home and the two sides will trade closing documents. Your legal representative will then register the new deed and mortgage, so anyone doing a search will see that you’re the new owner. Finally, you pick up the keys and YOU’RE IN!

After closing, your lawyer will send you a reporting letter and copies of all the documents you signed including the deed, the mortgage and the survey, and a summary of the flow of funds.

What is Deed?

The deed is held by the bank (mortgage company) until you have PAID them out.

You are holding a statement of charge on Title. as the only document available to you until the house is paid for. For the utilities and other people who would ask to see this, this should be enough.

Toronto (Bilingual)
Land Registry Office — REG, LT, AUTO, ER
20 Dundas Street West, Suite 420
Box 117
Toronto ON M5G 2C2
Tel: (416) 314-4430
Fax: (416)314-4453

http://www.aols.org/directories/lro.asp?division=Toronto&lro=&track=s

May 22, 2008

Cherish the Tough Times

Filed under: English — jennyca @ 12:05 am

by Justin Popovic

We’ve all been there at some point in our life. Everything seems to be moving along smoothly when something suddenly happens; a challenge, a barrier, a crisis. These events can range anywhere from being mildly inconvenient to downright terrible and sometimes devastating. When situations like this arise, we all have ultimately one choice to make – how we will choose to respond.

When you boil it down, that is really how our entire life unfolds. We are making a never ending series of choices about how we will interact with the events and circumstances surrounding us. Many of these choices occur unconsciously as part of our conditioned behaviour patterns. Understanding that we always retain the power and the right to make a conscious choice about our reactions is where we can transform challenges into opportunities.

Consider the idea of personal perception. Every person observes and interprets the world around them from a unique vantage point. I remember very clearly an incident about 5 years ago when I was having lunch on a restaurant patio with a few of my colleagues. The patio was next to a very busy street. About 20 minutes into our meal, we were all startled by a large crash followed by an excitable YELP sound. As I turned in my seat to examine the incident, we saw a new sports car t-boned by an older sedan. Fortunately, the collision had taken place at a relatively slow speed so there were no injuries, just two very upset drivers. The YELP sound had come from a tow truck driver who had been parked literally across the street. He was so excited that an accident had occurred right in front of his truck meaning he would be the first tow provider on the scene. Talk about drastically opposing perspectives! These two unfortunate drivers were caught up in a very unpleasant experience while the tow truck entrepreneur had his latest gig essentially fall into his lap.

What’s most interesting about this example is that it illustrates to me that the world around us simply exists, nothing more, nothing less. It is not until we apply our personal perception along with all of our expectations and beliefs, that events become positive or negative. Since we are creative by nature and always have 100% control over our thoughts, we can then choose to seek out the positives in life. When something happens to us that initially appears to be negative, we have an opportunity to reject our habitual reaction and create a new, more empowering belief about that event.

I have personally made a habit of this type of mentality and I continue to develop this capability with every passing day. I am becoming someone who can cherish the tough times. When adversity strikes, I am often able to control my attitude and remain focused on the positive rather than being consumed by the apparent misfortune. I then remind myself of Robert Collier’s quote, “In every adversity there lies the seed of an equivalent advantage.

Dustin Carter is no stranger to adversity. We recently featured his YouTube video on the Ignite Your Essence website. Dustin was diagnosed with a rare blood disorder at age 5. The doctors were forced to amputate the majority of all of his limbs. Despite his obvious challenges, Dustin is now a top student wrestler working towards a full wrestling scholarship. He is a tremendous inspiration to everyone who meets him and he gives hope to others who may be facing physical challenges.

Many successful entrepreneurs have been able to transform challenging life situations into business building opportunities. One of the best examples of this is Robert Allen. His book, Nothing Down: How to Buy Real Estate with Little or No Money Down, went to the top of the New York Times Best-Seller list after a controversial ad he ran to promote it. In the ad, Allen claimed that you could take him to any city, take his wallet away, give him $100 and he could buy a piece of real estate. After Allen’s book had achieved great success, a reporter from the LA Times challenged his claim in the ad and called him a fraud. In order to prove himself, Allen was forced to take the challenge and prove he could actually achieve the feat. Not knowing if he would actually be able to pull it off, Robert Allen began to worry and realized that he would be professionally ruined if he was not able to deliver. In a formally arranged meeting, the reporter met Allen in San Francisco, took his wallet and gave him $100. With his name and credibility on the line, Allen took the $100 and purchased 7 properties worth $700,000 in a 57 hour window. Needless to say, he went on to achieve enormous success in his career.

How would your life change if you were able to transform a negative event into a positive experience? What kind of results could you produce if you learned to embrace adversity and treat it as an opportunity for growth? Regardless of the nature of the challenge you are facing, decide to become the kind of person who embodies this philosophy and you will most assuredly begin to produce incredible things in your life while providing inspiration to those around you!

http://www.success.bz/articles/2020/cherish_the_tough_times

May 21, 2008

PLS-00201

Filed under: PL/SQL — jennyca @ 8:51 pm

variable SCN number

exec :scn := dbms_flashback.get_system_change_number

ERROR at line 1:
ORA-06550: line 1, column 15:
PLS-00201: identifier ‘DBMS_FLASHBACK’ must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

conn / as sysdba
grant execute on sys.DBMS_FLASHBACK to hr;
conn hr/hr

exec :scn := dbms_flashback.get_system_change_number

PL/SQL procedure successfully completed.

SQL> print scn

SCN
———-
1598575

May 12, 2008

The Proven Way To Go Get Whatever You Want!

Filed under: English — jennyca @ 4:13 pm

by Mark Duin

Have you ever wondered how the tiny nation of Japan came to dominate so many world Industries. They took over the worlds steel industry in the 70’s (even though they don’t have any steel on their tiny island). They took over the world’s electronic industry in the 1980’s. Now they’ve taken over the world’s auto industry.

How in the world can a county the size of Montana dominate the entire world in so many major industries?

Planning, that’s how. The Japanese plan their industry moves in 10 year increments. While American business thinks very short term, “how can we make our numbers this quarter”. Japan has a big picture plan to follow. They have a long term strategy and make all their decisions in relation to their goals. Sure they adjust their plan if needed but they do have a plan to succeed, and they do succeed.

If you’ve been in the business world very long you’ve observed numerous projects, some succeed and some fail. It’s no surprise that a common factor of successful projects is that they all have a good project plan. Most failed projects on the other hand have no planning or poor planning in common. It’s exactly the same for individuals like you and me.

Amazingly, almost all successful people create a plan for their careers and for their lives. Once they set a goal for any area of their lives, career, fitness, personal development and so on, they make a plan to achieve it. That’s why they succeed more often than not, instead of the other way around.

Today you too can join the ranks of the world’s most successful people. All you need to do is spend a little time with that amazing brain of yours and simply create a strategy to get what you want. Just start setting a few goals and creating plans to attain them!

Here’s an outline that can help…

Step 1 – Define what you really want and why it’s important to you!

Step 2 – List everything you need to do to get where you want to go!

Step 3 – Create a master task list of simple actions you can take.

Step 4 – Organize all your tasks into byte size time frames.

Next 30 Days
1 Month to 2 Months Out
2 Months to 3 Months Out… and so on…

Step 5 – Take out your first 30 day task list and work on it every day for 30 days.

Step 6 – Take out your next task list and work on it every day for 30 days.

If you have any left over items from one list, just add them to the next list and keep going.

Before you know it you’ll find you’re accomplishing far more in 30, 60, 90 days than many people accomplish in years. Once I mapped out and wrote an entire book in about 60 days, while most people who say they want to write a book never even get started! Keep in mind I’m no genius. I was a 9th grade drop out till age 27 and had only ready 2 books cover to cover by my early 30’s!

People often ask me how I’ve been able to accomplish so much and be so successful. I usually let them know the truth. You can go get almost anything you want if you…

1. Know what you want (if you don’t know, take time to figure out what you want).

2. Make a plan to get what you want.

3. Constantly find ways to make yourself follow your plan.

If it can work for the nation of Japan and for former street dwelling drop out’s like me, it will work for you too!

Before I finish this article I’d like to ask you a straight forward question. If someone shared with you the secret of how to get whatever you want almost every single time, would you use it?

It’s true, you can have almost anything you want. So go for it already and start enjoying even more of life you deeply desire!

http://www.success.bz/articles/2001/the_proven_way_to_go_get_whatever_you_want

Next Page »

Blog at WordPress.com.