今天JAVA界发生了件大事–ORACLE把SUN吃掉了…

本来预计是IBM拿下的,可惜IBM担心像微软那样被托拉斯法案缠身,就放弃了…

然而很有戏剧性的一幕就是在IBM放弃收购SUN的10天内,ORACLE就把SUN并购了。

现在轮到IBM头疼了,ORACLE变成了IBM最大的对手…

今后Java会怎么走?我们只有拭目以待了~

下面就让我们来看一下双方CEO发表的公开信吧:


第一封是SUN的总裁兼CEO Jonathan Schwartz致所有员工的信:

Jonathan

Today‘s Sun/Oracle Announcement

This is one of the toughest emails I‘ve ever had to write.

It‘s also one of the most hopeful about Sun‘s future in the industry.

For 27 years, Sun has stood for courage, innovation, a willingness to blaze trails, to envision and engineer the future. No matter our ups and downs, we‘ve remained committed to those ideals, and to the R&D that‘s allowed us to differentiate. We‘ve committed to decade long pursuits, from the evolution of one of the world‘s most powerful datacenter operating systems, to one of the world‘s most advanced multi-core microelectronics. We‘ve never walked away from the wholesale reinvention of business models, the redefinition of technology boundaries or the pursuit of new routes to market.

Because of the unparalleled talent at Sun, we‘ve also fueled entire industries with our people and technologies, and fostered extraordinary companies and market successes. Our products and services have driven the discovery of new drugs, transformed social media, and created a better understanding of the world and marketplace around us. All, while we‘ve undergone a near constant transformation in the face of a rapidly changing marketplace and global economy. We‘ve never walked away from a challenge – or an opportunity.

So today we take another step forward in our journey, but along a different path – by announcing that this weekend, our board of directors and I approved the acquisition of Sun Microsystems by the Oracle Corporation for $9.50/share in cash. All members of the board present at the meeting to review the transaction voted for it with enthusiasm, and the transaction stands to utterly transform the marketplace – bringing together two companies with a long history of working together to create a newly unified vision of the future.

Oracle‘s interest in Sun is very clear – they aspire to help customers simplify the development, deployment and operation of high value business systems, from applications all the way to datacenters.  By acquiring Sun, Oracle will be well positioned to help customers solve the most complex technology problems related to running a business.

To me, this proposed acquisition totally redefines the industry, resetting the competitive landscape by creating a company with great reach, expertise and innovation. A combined Oracle/Sun will be capable of cultivating one of the world‘s most vibrant and far reaching developer communities, accelerating the convergence of storage, networking and computing, and delivering one of the world‘s most powerful and complete portfolios of business and technical software.

I do not consider the announcement to be the end of the road, not by any stretch of the imagination. I believe this is the first step down a different path, one that takes us and our innovations to an even broader market, one that ensures the ubiquitous role we play in the world around us. The deal was announced today, and, after regulatory review and shareholder approval,  will take some months to close – until that close occurs, however, we are a separate company, operating independently. No matter how long it takes, the world changed starting today.

But it‘s important to note it‘s not the acquisition that‘s changing the world – it‘s the people that fuel both companies. Having spent a considerable amount of time talking to Oracle, let me assure you they are single minded in their focus on the one asset that doesn‘t appear in our financial statements: our people. That‘s their highest priority – creating an inviting and compelling environment in which our brightest minds can continue to invent and deliver the future.

Thank you for everything you‘ve done over the years, and for everything you will do in the future to carry the business forward.  I‘m incredibly proud of this company and what we‘ve accomplished together.

Details will be forthcoming as we work together on the integration planning process.

Jonathan

Additional Information and Where to Find It

Sun plans to file with the Securities and Exchange Commission (the “SEC”) and mail to its stockholders a proxy statement in connection with the proposed merger with Soda Acquisition Corporation, pursuant to which Sun would be acquired by Oracle Corporation (the “Merger”).  The proxy statement will contain important information about the proposed Merger and related matters.  INVESTORS AND STOCKHOLDERS ARE URGED TO READ THE PROXY STATEMENT CAREFULLY WHEN IT BECOMES AVAILABLE.  Investors and stockholders will be able to obtain free copies of the proxy statement and other documents filed with the SEC by Sun through the web site maintained by the SEC at  www.sec.gov.  In addition, investors and stockholders will be able to obtain free copies of the proxy statement from Sun by contacting Investor Relations by telephone at (800) 801-7869 (within the U.S.) or (408) 404-8427 (outside the U.S.), or by mail at Sun Microsystems, Inc., Investor Relations, Mail Stop UMPK14-336, 4150 Network Circle, Santa Clara, California 95054, USA.

Sun and its directors and executive officers may be deemed to be participants in the solicitation of proxies from the stockholders of Sun in connection with the proposed Merger.  Information regarding the interests of these directors and executive officers in the transaction described herein will be included in the proxy statement described above.  Additional information regarding these directors and executive officers is also included in Sun’s proxy statement for its 2008 Annual Meeting of Stockholders, which was filed with the SEC on September 24, 2008. This document is available free of charge at the SEC’s web site at  www.sec.gov, and from Sun by contacting Investor Relations by telephone at (800) 801-7869 (within the U.S.) or (408) 404-8427 (outside the U.S.), or by mail at Sun Microsystems, Inc., Mail Stop UMPK14-336, 4150 Network Circle, Santa Clara, California 95054, USA, or by going to Sun’s Investor Relations page on its corporate web site at  www.sun.com.

Note on Forward-Looking Statements

This communication contains certain forward-looking statements within the meaning of Section 27A of the Securities Act of 1933 and Section 21E of the Securities Exchange Act of 1934, including but not limited to, statements regarding the expected benefits and closing of the proposed Merger.  These forward-looking statements involve certain risks and uncertainties that could cause actual results to differ materially from those indicated in such forward-looking statements, including, but not limited to, the ability of the parties to consummate the proposed Merger, satisfaction of closing conditions precedent to the consummation of the proposed Merger, the ability of Oracle Corporation to successfully integrate Sun’s operations and employees, the ability to realize anticipated synergies and cost savings of the proposed Merger, and such other risks as identified in Sun’s Annual Report on Form 10-K for the fiscal year ended June 30, 2008, and Sun’s most recent Quarterly Reports on Form 10-Q, each as filed with the SEC, which contain and identify important factors that could cause the actual results to differ materially from those contained in the forward-looking statements.  Sun assumes no obligation to update any forward-looking statement contained in this communication.


第二封是甲骨文总裁Charles Phillips致信客户的信:

  On April 20, 2009, Oracle announced that it had agreed to acquire Sun Microsystems. The proposed transaction is subject to Sun stockholder approval, certain regulatory approvals and customary closing conditions. Until the deal closes, each company will continue to operate independently, and it is business as usual.

  This acquisition combines best-in-class enterprise software and mission-critical computing systems. Oracle plans to engineer and deliver an integrated system—applications to disk—where all the pieces fit and work together so customers do not have to do it themselves. Customers benefit as their systems integration costs go down while system performance, reliability, and security go up.

  Oracle‘s ownership of two key Sun software assets, Java and Solaris, is expected to provide our customers with significant benefit. Java is one of the computer industry‘s best known brands and most widely deployed technologies. Oracle Fusion Middleware is built on top of Sun‘s Java language and software. Oracle can now ensure continued innovation and investment in Java technology for the benefit of customers and the Java community.

  The Sun Solaris operating system is the leading platform for the Oracle database. With the acquisition of Sun, Oracle can optimize the Oracle database for some of the unique, high-end features of Solaris. Oracle is as committed as ever to Linux and other open platforms, and will continue to support and enhance our strong industry partnerships.

  Our customers have been asking us to step up to a broader role to reduce complexity, risk, and cost by delivering a highly-optimized standards-based product stack. Oracle plans to deliver these benefits by offering a broad range of products, including servers and storage, with all the integrated pieces: hardware operating system, database, middleware and applications. We plan to preserve and enhance investments made by our customers, while we continue to work with our partners to provide customers with choice.

  We are dedicated to maintaining and increasing the quality of innovation, support, and service that you have come to expect from Oracle and Sun. To learn more about the Sun acquisition, please visit oracle.com/sun.

  Sincerely,

  Charles Phillips

  President, Oracle

 

 

  准备工作:

  1.安装OCA。运行Developer的安装盘,选择自定义安装,选择Oracle Open Client Adapter for ODBC安装。

  2.在数据源(ODBC)中添加DSN。控制面板->管理工具->数据源(ODBC),选择“用户DSN”,添加要进行操作的Access的文件。在“高级”选项里,填上“登录名称”和“密码”(很重要,在程序中会用到)。

  下面以实际例子来说明:

  假设在Oracle中和Access中都有一个student表,表中字段相同(name char(10) ,age number(2)),在准备工作2中的“数据源名”为test,“登录名称”和“密码”都为user。

  下面为从Oracle导出到Access的procedure:

以下是引用片段:
  PROCEDURE oracle_to_access IS
  connection_id EXEC_SQL.ConnType;
  action_cursor EXEC_SQL.CursType;
  ignore PLS_INTEGER;
  t_name student.name%type;
  t_age student.age%type;
  cursor temp_cursor is select * from student;
  BEGIN
  connection_id:= EXEC_SQL.OPEN_CONNECTION(‘user/user@odbc:test‘);
  action_cursor := EXEC_SQL.OPEN_CURSOR(connection_id);
  EXEC_SQL.PARSE(connection_id, action_cursor,‘delete * from student‘);
  ignore := EXEC_SQL.EXECUTE(connection_id, action_cursor);
  EXEC_SQL.CLOSE_CURSOR(connection_id,action_cursor);
  open temp_cursor;
  export_count := 0;
  action_cursor := EXEC_SQL.OPEN_CURSOR(connection_id);
  EXEC_SQL.PARSE(connection_id, action_cursor,‘INSERT INTO student(name,age) values(:1,:2)‘);
  loop
  fetch temp_cursor into t_name,t_age;
  exit when temp_cursor%notfound;
  EXEC_SQL.BIND_VARIABLE(connection_id,action_cursor, ‘:1‘, t_name);
  EXEC_SQL.BIND_VARIABLE(connection_id,action_cursor, ‘:2‘, t_age);
  ignore := EXEC_SQL.EXECUTE(connection_id, action_cursor);
  end loop;
  close temp_cursor;
  EXEC_SQL.PARSE(connection_id, action_cursor,‘commit‘);
  ignore := EXEC_SQL.EXECUTE(connection_id,action_cursor);
  EXEC_SQL.CLOSE_CURSOR(connection_id,action_cursor);
  EXEC_SQL.CLOSE_CONNECTION(connection_id);
  EXCEPTION
  WHEN EXEC_SQL.PACKAGE_ERROR THEN
  IF EXEC_SQL.LAST_ERROR_CODE(connection_id) != 0 THEN
  message(‘数据导出至ACCESS失败: ‘ || TO_CHAR(EXEC_SQL.LAST_ERROR_CODE(connection_id)) || ‘: ‘ || EXEC_SQL.LAST_ERROR_MESG(connection_id));
  END IF;
  IF EXEC_SQL.IS_CONNECTED(connection_id) THEN
  IF EXEC_SQL.IS_OPEN(connection_id,action_cursor) THEN
  EXEC_SQL.CLOSE_CURSOR(connection_id,action_cursor);
  END IF;
  EXEC_SQL.CLOSE_CONNECTION(connection_id);
  END IF;
  END;
  下面为从Access导出到Oracles的procedure:
  PROCEDURE Access_to_oracle IS
  connection_id EXEC_SQL.ConnType;
  action_cursor EXEC_SQL.CursType;
  ignore PLS_INTEGER;
  t_name student.name%type;
  t_age student.age%type;
  BEGIN
  connection_id := EXEC_SQL.OPEN_CONNECTION(‘user/user@odbc:test‘);
  action_cursor := EXEC_SQL.OPEN_CURSOR(connection_id);
  delete from student;
  EXEC_SQL.PARSE(connection_id, action_cursor,‘select name,age from student‘);
  ignore := EXEC_SQL.EXECUTE(connection_id, action_cursor);
  exec_sql.define_column(connection_id,action_cursor,1,t_name,10);
  exec_sql.define_column(connection_id,action_cursor,2,t_age);
  ignore := EXEC_SQL.EXECUTE(connection_id, action_cursor);
  while(exec_sql.fetch_rows(connection_id,action_cursor)>0)
  loop
  exec_sql.column_value(connection_id,action_cursor,1,t_name);
  exec_sql.column_value(connection_id,action_cursor,2,t_age);
  insert into test(name,age) values(t_name,t_age);
  end loop;
  commit;
  EXEC_SQL.CLOSE_CURSOR(connection_id,action_cursor);
  EXEC_SQL.CLOSE_CONNECTION(connection_id);
  EXCEPTION
  WHEN EXEC_SQL.PACKAGE_ERROR THEN
  IF EXEC_SQL.LAST_ERROR_CODE(connection_id) != 0 THEN
  message(‘数据导入至ORACLE失败: ‘ || TO_CHAR(EXEC_SQL.LAST_ERROR_CODE(connection_id)) || ‘: ‘ || EXEC_SQL.LAST_ERROR_MESG(connection_id));
  END IF;
  IF EXEC_SQL.IS_CONNECTED(connection_id) THEN
  IF EXEC_SQL.IS_OPEN(connection_id,action_cursor) THEN
  EXEC_SQL.CLOSE_CURSOR(connection_id,action_cursor);
  END IF;
  EXEC_SQL.CLOSE_CONNECTION(connection_id);
  END IF;
  END;

  注意:EXEC_SQL.BIND_VARIABLE中绑定的变量只能是以下三种类型:NUMBER,DATE,VARCHAR2。对于Access中的“是/否”的布尔型变量,可以用NUMBER类型的1和0来表示。如果Access中的表名或者字段名中有空格,在写SQL语句的时候可以用双引号把表名或者字段名包括起来,如:本例中如果Access中表名为student detail,字段名分别为student name和student age,那插入数据的SQL语句为:insert into “student detail”(“student name”,”student age”) values(:1,:2).

SQL中的单记录函数
1.ASCII
返回与指定的字符对应的十进制数;
SQL> select ascii(‘A‘) A,ascii(‘a‘) a,ascii(‘0‘) zero,ascii(‘ ‘) space from dual;

A         A      ZERO     SPACE
——— ——— ——— ———
65        97        48        32

2.CHR
给出整数,返回对应的字符;
SQL> select chr(54740) zhao,chr(65) chr65 from dual;

ZH C
— –
赵 A

3.CONCAT
连接两个字符串;
SQL> select concat(‘010-‘,‘88888888‘)||‘转23‘  高乾竞电话 from dual;

高乾竞电话
—————-
010-88888888转23

4.INITCAP
返回字符串并将字符串的第一个字母变为大写;
SQL> select initcap(‘smith‘) upp from dual;

UPP
—–
Smith

5.INSTR(C1,C2,I,J)
在一个字符串中搜索指定的字符,返回发现指定的字符的位置;
C1    被搜索的字符串
C2    希望搜索的字符串
I     搜索的开始位置,默认为1
J     出现的位置,默认为1
SQL> select instr(‘oracle traning‘,‘ra‘,1,2) instring from dual;

INSTRING
———
9

6.LENGTH
返回字符串的长度;
SQL> select name,length(name),addr,length(addr),sal,length(to_char(sal)) from .nchar_tst;

NAME   LENGTH(NAME) ADDR             LENGTH(ADDR)       SAL LENGTH(TO_CHAR(SAL))
—— ———— —————- ———— ——— ——————–
高乾竞            3 北京市海锭区                6   9999.99                    7

 

7.LOWER
返回字符串,并将所有的字符小写
SQL> select lower(‘AaBbCcDd‘)AaBbCcDd from dual;

AABBCCDD
——–
aabbccdd

8.UPPER
返回字符串,并将所有的字符大写
SQL> select upper(‘AaBbCcDd‘) upper from dual;

UPPER
——–
AABBCCDD

 

9.RPAD和LPAD(粘贴字符)
RPAD  在列的右边粘贴字符
LPAD  在列的左边粘贴字符
SQL> select lpad(rpad(‘gao‘,10,‘*‘),17,‘*‘)from dual;

LPAD(RPAD(‘GAO‘,1
—————–
*******gao*******
不够字符则用*来填满

10.LTRIM和RTRIM
LTRIM  删除左边出现的字符串
RTRIM  删除右边出现的字符串
SQL> select ltrim(rtrim(‘   gao qian jing   ‘,‘ ‘),‘ ‘) from dual;

LTRIM(RTRIM(‘
————-
gao qian jing

11.SUBSTR(string,start,count)
取子字符串,从start开始,取count个
SQL> select substr(‘13088888888‘,3,8) from dual;

SUBSTR(‘
——–
08888888

12.REPLACE(‘string‘,‘s1‘,‘s2‘)
string   希望被替换的字符或变量
s1       被替换的字符串
s2       要替换的字符串
SQL> select replace(‘he love you‘,‘he‘,‘i‘) from dual;

REPLACE(‘HELOVEYOU‘,‘HE‘,‘I‘)
——————————
i love you

13.SOUNDEX
返回一个与给定的字符串读音相同的字符串
SQL> create table table1(xm varchar(8));
SQL> insert into table1 values(‘weather‘);
SQL> insert into table1 values(‘wether‘);
SQL> insert into table1 values(‘gao‘);

SQL> select xm from table1 where soundex(xm)=soundex(‘weather‘);

XM
——–
weather
wether

14.TRIM(‘s‘ from ‘string‘)
LEADING   剪掉前面的字符
TRAILING  剪掉后面的字符
如果不指定,默认为空格符

15.ABS
返回指定值的绝对值
SQL> select abs(100),abs(-100) from dual;

ABS(100) ABS(-100)
——— ———
100       100

16.ACOS
给出反余弦的值
SQL> select acos(-1) from dual;

ACOS(-1)
———
3.1415927

17.ASIN
给出反正弦的值
SQL> select asin(0.5) from dual;

ASIN(0.5)
———
.52359878

18.ATAN
返回一个数字的反正切值
SQL> select atan(1) from dual;

ATAN(1)
———
.78539816

19.CEIL
返回大于或等于给出数字的最小整数
SQL> select ceil(3.1415927) from dual;

CEIL(3.1415927)
—————
      4

20.COS
返回一个给定数字的余弦
SQL> select cos(-3.1415927) from dual;

COS(-3.1415927)
—————
     -1

21.COSH
返回一个数字反余弦值
SQL> select cosh(20) from dual;

COSH(20)
———
242582598

22.EXP
返回一个数字e的n次方根
SQL> select exp(2),exp(1) from dual;

EXP(2)    EXP(1)
——— ———
7.3890561 2.7182818

23.FLOOR
对给定的数字取整数
SQL> select floor(2345.67) from dual;

FLOOR(2345.67)
————–
  2345

24.LN
返回一个数字的对数值
SQL> select ln(1),ln(2),ln(2.7182818) from dual;

LN(1)     LN(2) LN(2.7182818)
——— ——— ————-
0 .69314718     .99999999

25.LOG(n1,n2)
返回一个以n1为底n2的对数
SQL> select log(2,1),log(2,4) from dual;

LOG(2,1)  LOG(2,4)
——— ———
0         2

26.MOD(n1,n2)
返回一个n1除以n2的余数
SQL> select mod(10,3),mod(3,3),mod(2,3) from dual;

MOD(10,3)  MOD(3,3)  MOD(2,3)
——— ——— ———
1         0         2

27.POWER
返回n1的n2次方根
SQL> select power(2,10),power(3,3) from dual;

POWER(2,10) POWER(3,3)
———– ———-
1024         27

28.ROUND和TRUNC
按照指定的精度进行舍入
SQL> select round(55.5),round(-55.4),trunc(55.5),trunc(-55.5) from dual;

ROUND(55.5) ROUND(-55.4) TRUNC(55.5) TRUNC(-55.5)
———– ———— ———– ————
 56          -55          55          -55

29.SIGN
取数字n的符号,大于0返回1,小于0返回-1,等于0返回0
SQL> select sign(123),sign(-100),sign(0) from dual;

SIGN(123) SIGN(-100)   SIGN(0)
——— ———- ———
1         -1         0

30.SIN
返回一个数字的正弦值
SQL> select sin(1.57079) from dual;

SIN(1.57079)
————
   1

31.SIGH
返回双曲正弦的值
SQL> select sin(20),sinh(20) from dual;

 

SIN(20)  SINH(20)
——— ———
.91294525 242582598

32.SQRT
返回数字n的根
SQL> select sqrt(64),sqrt(10) from dual;

SQRT(64)  SQRT(10)
——— ———
8 3.1622777

33.TAN
返回数字的正切值
SQL> select tan(20),tan(10) from dual;

TAN(20)   TAN(10)
——— ———
2.2371609 .64836083

34.TANH
返回数字n的双曲正切值
SQL> select tanh(20),tan(20) from dual;

TANH(20)   TAN(20)
——— ———
1 2.2371609

 

35.TRUNC
按照指定的精度截取一个数
SQL> select trunc(124.1666,-2) trunc1,trunc(124.16666,2) from dual;

TRUNC1 TRUNC(124.16666,2)
——— ——————
100             124.16

 

36.ADD_MONTHS
增加或减去月份
SQL> select to_char(add_months(to_date(‘199912‘,‘yyyymm‘),2),‘yyyymm‘) from dual;

TO_CHA
——
200002
SQL> select to_char(add_months(to_date(‘199912‘,‘yyyymm‘),-2),‘yyyymm‘) from dual;

TO_CHA
——
199910

37.LAST_DAY
返回日期的最后一天
SQL> select to_char(sysdate,‘yyyy.mm.dd‘),to_char((sysdate)+1,‘yyyy.mm.dd‘) from dual;

TO_CHAR(SY TO_CHAR((S
———- ———-
2004.05.09 2004.05.10
SQL> select last_day(sysdate) from dual;

LAST_DAY(S
———-
31-5月 -04

38.MONTHS_BETWEEN(date2,date1)
给出date2-date1的月份
SQL> select months_between(‘19-12月-1999‘,‘19-3月-1999‘) mon_between from dual;

MON_BETWEEN
———–
  9
SQL>selectmonths_between(to_date(‘2000.05.20‘,‘yyyy.mm.dd‘),to_date(‘2005.05.20‘,‘yyyy.dd‘)) mon_betw from dual;

MON_BETW
———
-60

39.NEW_TIME(date,‘this‘,‘that‘)
给出在this时区=other时区的日期和时间
SQL> select to_char(sysdate,‘yyyy.mm.dd hh24:mi:ss‘) bj_time,to_char(new_time
2  (sysdate,‘PDT‘,‘GMT‘),‘yyyy.mm.dd hh24:mi:ss‘) los_angles from dual;

BJ_TIME             LOS_ANGLES
——————- ——————-
2004.05.09 11:05:32 2004.05.09 18:05:32

40.NEXT_DAY(date,‘day‘)
给出日期date和星期x之后计算下一个星期的日期
SQL> select next_day(‘18-5月-2001‘,‘星期五‘) next_day from dual;

NEXT_DAY
———-
25-5月 -01

 

41.SYSDATE
用来得到系统的当前日期
SQL> select to_char(sysdate,‘dd-mm-yyyy day‘) from dual;

TO_CHAR(SYSDATE,‘
—————–
09-05-2004 星期日
trunc(date,fmt)按照给出的要求将日期截断,如果fmt=‘mi‘表示保留分,截断秒
SQL> select to_char(trunc(sysdate,‘hh‘),‘yyyy.mm.dd hh24:mi:ss‘) hh,
  2  to_char(trunc(sysdate,‘mi‘),‘yyyy.mm.dd hh24:mi:ss‘) hhmm from dual;

HH                  HHMM
——————- ——————-
2004.05.09 11:00:00 2004.05.09 11:17:00

 

42.CHARTOROWID
将字符数据类型转换为ROWID类型
SQL> select rowid,rowidtochar(rowid),ename from scott.emp;

ROWID              ROWIDTOCHAR(ROWID) ENAME
—————— —————— ———-
AAAAfKAACAAAAEqAAA AAAAfKAACAAAAEqAAA SMITH
AAAAfKAACAAAAEqAAB AAAAfKAACAAAAEqAAB ALLEN
AAAAfKAACAAAAEqAAC AAAAfKAACAAAAEqAAC WARD
AAAAfKAACAAAAEqAAD AAAAfKAACAAAAEqAAD JONES

43.CONVERT(c,dset,sset)
将源字符串 sset从一个语言字符集转换到另一个目的dset字符集
SQL> select convert(‘strutz‘,‘we8hp‘,‘f7dec‘) "conversion" from dual;

conver
——
strutz

44.HEXTORAW
将一个十六进制构成的字符串转换为二进制

45.RAWTOHEXT
将一个二进制构成的字符串转换为十六进制

 

46.ROWIDTOCHAR
将ROWID数据类型转换为字符类型

 

47.TO_CHAR(date,‘format‘)
SQL> select to_char(sysdate,‘yyyy/mm/dd hh24:mi:ss‘) from dual;

TO_CHAR(SYSDATE,‘YY
——————-
2004/05/09 21:14:41

 

48.TO_DATE(string,‘format‘)
将字符串转化为ORACLE中的一个日期

49.TO_MULTI_BYTE
将字符串中的单字节字符转化为多字节字符
SQL>  select to_multi_byte(‘高‘) from dual;

TO

50.TO_NUMBER
将给出的字符转换为数字
SQL> select to_number(‘1999‘) year from dual;

     YEAR
———
     1999

51.BFILENAME(dir,file)
指定一个外部二进制文件
SQL>insert into file_tb1 values(bfilename(‘lob_dir1‘,‘image1.gif‘));

52.CONVERT(‘x‘,‘desc‘,‘source‘)
将x字段或变量的源source转换为desc
SQL> select sid,serial#,username,decode(command,
  2  0,‘none‘,
  3  2,‘insert‘,
  4  3,
  5  ‘select‘,
  6  6,‘update‘,
  7  7,‘delete‘,
  8  8,‘drop‘,
  9  ‘other‘) cmd  from v$session where type!=‘background‘;

      SID   SERIAL# USERNAME                       CMD
——— ——— —————————— ——
        1         1                                none
        2         1                                none
        3         1                                none
        4         1                                none
        5         1                                none
        6         1                                none
        7      1275                                none
        8      1275                                none
        9        20 GAO                            select
       10        40 GAO                            none

53.DUMP(s,fmt,start,length)
DUMP函数以fmt指定的内部数字格式返回一个VARCHAR2类型的值
SQL> col global_name for a30
SQL> col dump_string for a50
SQL> set lin 200
SQL> select global_name,dump(global_name,1017,8,5) dump_string from global_name;

GLOBAL_NAME                    DUMP_STRING
—————————— ————————————————–
ORACLE.WORLD                   Typ=1 Len=12 CharacterSet=ZHS16GBK: W,O,R,L,D

54.EMPTY_BLOB()和EMPTY_CLOB()
这两个函数都是用来对大数据类型字段进行初始化操作的函数

55.GREATEST
返回一组表达式中的最大值,即比较字符的编码大小.
SQL> select greatest(‘AA‘,‘AB‘,‘AC‘) from dual;

GR

AC
SQL> select greatest(‘啊‘,‘安‘,‘天‘) from dual;

GR

56.LEAST
返回一组表达式中的最小值
SQL> select least(‘啊‘,‘安‘,‘天‘) from dual;

LE

57.UID
返回标识当前用户的唯一整数
SQL> show user
USER 为"GAO"
SQL> select username,user_id from dba_users where user_id=uid;

USERNAME                         USER_ID
—————————— ———
GAO                                   25

 

58.USER
返回当前用户的名字
SQL> select user from  dual;

USER
——————————
GAO

59.USEREVN
返回当前用户环境的信息,opt可以是:
ENTRYID,SESSIONID,TERMINAL,ISDBA,LABLE,LANGUAGE,CLIENT_INFO,LANG,VSIZE
ISDBA  查看当前用户是否是DBA如果是则返回true
SQL> select userenv(‘isdba‘) from dual;

USEREN
——
FALSE
SQL> select userenv(‘isdba‘) from dual;

USEREN
——
TRUE
SESSION
返回会话标志
SQL> select userenv(‘sessionid‘) from dual;

USERENV(‘SESSIONID‘)
——————–
                 152
ENTRYID
返回会话人口标志
SQL> select userenv(‘entryid‘) from dual;

USERENV(‘ENTRYID‘)
——————
                 0
INSTANCE
返回当前INSTANCE的标志
SQL> select userenv(‘instance‘) from dual;

USERENV(‘INSTANCE‘)
——————-
                  1
LANGUAGE
返回当前环境变量
SQL> select userenv(‘language‘) from dual;

USERENV(‘LANGUAGE‘)
—————————————————-
SIMPLIFIED CHINESE_CHINA.ZHS16GBK
LANG
返回当前环境的语言的缩写
SQL> select userenv(‘lang‘) from dual;

USERENV(‘LANG‘)
—————————————————-
ZHS
TERMINAL
返回用户的终端或机器的标志
SQL> select userenv(‘terminal‘) from dual;

USERENV(‘TERMINA
—————-
GAO
VSIZE(X)
返回X的大小(字节)数
SQL> select vsize(user),user from dual;

VSIZE(USER) USER
———– ——————————
          6 SYSTEM

 

60.AVG(DISTINCT|ALL)
all表示对所有的值求平均值,distinct只对不同的值求平均值
SQLWKS> create table table3(xm varchar(8),sal number(7,2));
语句已处理。
SQLWKS>  insert into table3 values(‘gao‘,1111.11);
SQLWKS>  insert into table3 values(‘gao‘,1111.11);
SQLWKS>  insert into table3 values(‘zhu‘,5555.55);
SQLWKS> commit;

SQL> select avg(distinct sal) from gao.table3;

AVG(DISTINCTSAL)
—————-
         3333.33

SQL> select avg(all sal) from gao.table3;

AVG(ALLSAL)
———–
    2592.59

61.MAX(DISTINCT|ALL)
求最大值,ALL表示对所有的值求最大值,DISTINCT表示对不同的值求最大值,相同的只取一次
SQL> select max(distinct sal) from scott.emp;

 

MAX(DISTINCTSAL)
—————-
            5000

62.MIN(DISTINCT|ALL)
求最小值,ALL表示对所有的值求最小值,DISTINCT表示对不同的值求最小值,相同的只取一次
SQL> select min(all sal) from gao.table3;

MIN(ALLSAL)
———–
    1111.11

63.STDDEV(distinct|all)
求标准差,ALL表示对所有的值求标准差,DISTINCT表示只对不同的值求标准差
SQL> select stddev(sal) from scott.emp;

STDDEV(SAL)
———–
  1182.5032

SQL> select stddev(distinct sal) from scott.emp;

STDDEV(DISTINCTSAL)
——————-
           1229.951

 

64.VARIANCE(DISTINCT|ALL)
求协方差

SQL> select variance(sal) from scott.emp;

VARIANCE(SAL)
————-
    1398313.9

65.GROUP BY
主要用来对一组数进行统计
SQL> select deptno,count(*),sum(sal) from scott.emp group by deptno;

   DEPTNO  COUNT(*)  SUM(SAL)
——— ——— ———
       10         3      8750
       20         5     10875
       30         6      9400

 

66.HAVING
对分组统计再加限制条件
SQL> select deptno,count(*),sum(sal) from scott.emp group by deptno having nt(*)>=5;

   DEPTNO  COUNT(*)  SUM(SAL)
——— ——— ———
       20         5     10875
       30         6      9400
SQL> select deptno,count(*),sum(sal) from scott.emp having count(*)>=5 group by tno ;

   DEPTNO  COUNT(*)  SUM(SAL)
——— ——— ———
       20         5     10875
       30         6      9400

67.ORDER BY
用于对查询到的结果进行排序输出
SQL> select deptno,ename,sal from scott.emp order by deptno,sal desc;

   DEPTNO ENAME            SAL
——— ———- ———
       10 KING            5000
       10 CLARK           2450
       10 MILLER          1300
       20 SCOTT           3000
       20 FORD            3000
       20 JONES           2975
       20 ADAMS           1100
       20 SMITH            800
       30 BLAKE           2850
       30 ALLEN           1600
       30 TURNER          1500
       30 WARD            1250
       30 MARTIN          1250
       30 JAMES            950

  没有人会否认ORACLE是全球最有影响的数据库产品之一;不过好的东西似乎总不是那么好用(初看起来如此),甚至有些无情--总会给layman们一个个无情的错误号。下面是我个人的总结,条条有用,希望能给初学者一点启示。

  关于“好的东西似乎总不是那么好用(初看起来如此)”的一个笑话:在参加 IBM DB2 512、513培训前,在校园网上下载到了安装程序,不过任凭我们几个同学研究个半天,也不知哪个文件是安装文件,竟没有安装成功。最后,一致认为:看来这个培训真是太有必要了!事后,才知道--我们下载的是4linux的!

[以8.1.6为例]:

1、ORA-12541:TNS:没有监听器

  原因:没有启动监听器或者监听器损坏。如果是前者,使用命令net start OracleOraHome81TNSListener(名字可能有出入)即可;如果是后者,则使用“Net8 Configuration Assistant”工具向导之“监听程序配置”增加一个监听器即可(基本不用写任何信息,一路OK。在添加之前可能需要把所有的监听器先删除!)

2、ORA-12500:TNS:监听程序无法启动专用服务器进程
  或
  ORA-12560:TNS:协议适配器错误

  原因:ORACLE的数据库服务没有启动。使用命令net start ORACLESERVICEORADB(ORADB为数据库名字)即可。如果仍没有解决,请继续向下看。

3、如果数据库服务启动失败,则很有可能是其注册表项值损坏,最好的做法是以下两步:

  1)ORADIM -DELETE -SID oradb 删除数据库服务项
  2)ORADIM -NEW -SID oradb 新增数据库服务项
  注:这个过程中如果出错,就重启计算机!

4、ORA-12154:TNS:能解析服务名

  原因:ORACLE的网络服务名没有正确配置。请使用“Net8 Configuration Assistant”工具向导之“本地网络服务名配置”配置TNS即可。如果仍没有解决,请继续向下看。

5、ORA-1034 :TNS:ORACLE不可用

  原因:ORACLE的数据库服务正确启动,但是数据库没有打开!

  使用命令:

  1)svrmgrl 启动服务管理器
  2)connect internal 以internal身份登陆
  3)startup 打开数据库

6、ORA-12560:TNS:协议适配器错误(顽固性的)

  原因:未知。

  解决:必杀技--打开“Windows任务管理器”,杀死ORACLE.exe及ORADIM.exe进程,书写自己的ora_startup.bat,执行之!

PS:

1、我的ora_startup.bat:

net start OracleOraHome81TNSListener
net start ORACLESERVICEORADB
svrmgrl 一般情况下不用,不过有时少不了它的,具体步骤见第5步。

2、我的ora_shutdown.bat:

net stop OracleOraHome81TNSListener
net stop ORACLESERVICEORADB

3、ORACLE相关服务名请参见“管理工具”之“服务”中以ORACLE开头的服务名

问题一:如保加载JDBC驱动程序

正常我们加载驱动程序有三个途径:

1)Class.forName(String)这想当于classLoader一个String指定的类,在装载时把该驱动程序的静态内容都初始化,其实这时驱动程序类调用了DriverManager.registerDriver(driver);方法
2)使用系统属性:System.getProperty().load(new FileInputStream("属性文件"));
在属性文件中指定jdbc.driver=drivername 这样的好处是可以同时加载多个JDBC,换数据库时不用访问JAVA源代码,只是修改属性文件
3)直接registerDriver(driver)这种方法最可靠,可以在任何环境下使用。

1)方法简单,但MS的JVM不能正确初始化。比如使用IE时在APPLET中就不能使用,应该用3)的方法。但3)方法在灵活性方面不如2),可以根据环境综合考虑。

问题二:大对象存储

一般来说,大对象存储是把文件存到数据库中,当然也可以内存中的超大字符串。对于象图片这样的文件当然是用二进制存储,这里有很多误区,网络上的教程99%都是行不通的,连SUN自己的文档都一直错误,虽然错误很小。按说二进制文件应该存为BLOB类型,但JBDC2并不能直接对BLOB存入二进制文件,如果你这样做,会得到一个IO而不是SQL异常,为此花了我近两个小时才弄清楚。

如果要把一个二制文件存入ORACLE,用标准的JDBC你就要用LONG ROW类型:
create table tb_file(name varchar(20),detail long row);
然后
File file = new File("aaa.gif");
int fileLength =(int) file.length();
InputStream fin = new FileInputStream(file);
PreparedStatement pstmt = con.prepareStatement("insert into tb_file values(´aaa.gif´,?)");
pstmt.setBinaryStream (1, fin, fileLength);
pstmt.executeUpdate();

如果你一定要用BLOB存储,你就必须用ORACLE自己的方法:
create table tb_file(name varchar(20),detail BLOB);
con.setAutoCommit(false);
stmt.executeUpdate("insert into tb_file values(´aaa.gif´,empty_blob())");
下面必须SELECT得到BLOB的对象再向里写:
rs = stmt.executeQuery("select detail from tb_file where name=´aaa.gif´ for upfdate" );
if(rs.next())
{
Blob blob = rs.getBlob(1);
BinaryOutputStream out = ((oracle.sql.BLOB)blob).getBinaryOutputStream();
byte[] b = new byte[((oracle.sql.BLOB)blob).getBufferSize];
InputStream fin = new FileInputStream(file);
int len = 0;
while( (len = fin.read(b)) != -1)
out.write(b,0,len);
fin.close();
out.close();
con.commit();
}

同样读取数据你并不能象LONG ROW那样
InputStream in = rs.getBinaryInputStream("detail");
而要
Blob blob = rs.getBlob("detail");
in = blob.getBinaryStream();

问题三:可滚动结果集

ORACLE 明确说明不支持结果集滚动,那么我们用JDBC2得到一个可滚动的结果集就是同JDBC自己支持的,就是说结果集要在内在中高度缓存,很多很多的开发者都错误地认为是数据库支持的。只是他们没有真正查询大量行,如果真的查询大量行的话肯定是死定了!对于超大量行的数据,情愿返回到它的笨方法也不要使用可滚动结果集.

Red Hat Enterprise Linux ES release 3 (Taroon) Kernel 2.4.21-4.EL ON on i6868
Oracle9i Release 9.2.0.4

首先除了LINUX和ORACLE安装盘之外,还要准备一些补丁包:
p3095277_9204_LINUX.zip
下载地址:http://www.sh.nu/download/oracle/p305277_9204_LINUX.zip
p2617419_210_GENERIC.zip 、 p3006854_9204_LINUX.zip、
p3119415_9204_LINUX.zip、 P3238244_9204_LINUX.zip
下载地址:http://www.cnoug.org/viewthread.php?tid=30405&highlight=&page=2 http://www.itpub.net/showthread.php?s=&postid=1583482#post1583482
http://www.opennet.ru/soft/ora_inst/

(一) Oracle公司声称在Linux下安装Oracle9i数据库至少要有512MB的内存和至少1GB或者两倍 内存大小的交换空间,哈哈!恰好我的机器刚好满足它的最低要求,不过我听说256M也能安装ORACLE,本人对此深信不疑,当系统内存大于2GB的服务器,交换空间可以介于2GB—4GB之间。
要检查内存空间,在命令行方式(bash环境)下执行如下命令:
grep MemTotal /proc/meminfo

要检查交换空间,在命令行下执行如下命令:
grep SwapTotal /proc/meminfo

第二点是主机名和IP地址最好要手动设置
(二) 检查系统下是否有以下软件包
compat-libstdc++-7.3-2.96.122
compat-gcc-c++-7.3-2.96.122
compat-libstdc++-devel-7.3-2.96.122
compat-db-4.0.14-5
compat-gcc-7.3-2.96.122
tcl-devel-8.3.5-92.i386.ipm
openmotif21-2.1.30-8
setarch-1.3-1
如果没有可以采用#rpm –ivh ……rpm 来安装,具体大多数在第三张盘上,还有,这些包有一定的依赖性,这就需要你来动手试了。
(三) 添加安装过程中需要用到的用户和组,这当中会用到二个用户一个是root,一个是oracle
#groupadd oinstall
#groupadd dba
#useradd –g oinstall –G dba oracle
#passwd oracle
(四) 新建安装目录
#mkdir –p /opt/oracle/product/9.2.0
#chown –R oracle.oinstall /opt/oracle
#mkdir /var/opt/oracle
#chown oracle.dba /var/opt/oracle
#chmod 755 /var/opt/oracle
(五) 设置内核参数,调节信号灯及共享内存
(1)设置内核参数,调节信号灯及共享内存:
[root@sun root]# echo 250 32000 100 128 > /proc/sys/kernel/sem
[root@sun root]# echo 536870912 > /proc/sys/kernel/shmmax
[root@sun root]# echo 4096 > /proc/sys/kernel/shmmni
[root@sun root]# echo 2097152 > /proc/sys/kernel/shmall
[root@sun root]# echo 65536 > /proc/sys/fs/file-max
[root@sun root]# echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range
当然为了一开机系统就能自动帮你设好这些参数,也可改动 /etc/sysctl.conf 这个文件,加入以下的语句:
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
注意:如果你的共享内存不够大的话,在安装的过程中会提示ORA-27123错误,到时候你只要把/proc/sys/kernel/shmmax的值调大就可以了到于多大就看你的了
(六) oracle对文件的要求:
编辑文件:/etc/security/limits.conf 加入以下语句:
oracle    soft    nofile    65536
oracle    hard    nofile   65536
oracle    soft    nproc    16384
oracle    hard    nproc    16384
(七) 设置oracle的环境
#su – oracle
$ vi ~/.bash_profile
export LD_ASSUME_KERNEL=2.4.1
export DISPLAY=”192.168.9.205:0.0” (127.0.0.1:0.0)
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/9.2.0
export ORACLE_SID=ora9i (数据库全局变量名)
export ORACLE_TERM=xterm (xterm窗口模式 vt100 终端调试模式)
export NLS_LANG=AMERICAN (设置语言AMERICAN英文)
export ORACLE_OWNER=oracle
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export THREADS_FLAG=native
export LD_LIBRARY_PATH=/opt/oracle/product/9.2.0/lib:/lib:/usr
/lib:/usr/local/lib
export PATH=/opt/ora9/product/9.2/bin:$PATH
export PATH=$PATH:$ORACLE_HOME/bin
然后注销再重新登录就可以,oracle 的环境就应该生效了
(八) #xhost +192.168.0.2 (本地IP地址)
(xhost disable访问控制,客户端可以从任何主机进行连接)
这个命令用来保证oracle用户调用X11,否则无法安装
(九) 安装
在安装之前需要打一个补丁
为了应用这个补丁,可以运行:
$su – root
#unzip p3006854_9204_LINUX.zip
Archive:p3006854_9204_LINUX.zip
creating:3006854/
inflating:3006854/rhel3_pre_install.sh
inflating:3006854/README.txt

#cd 3006854
#sh rhel_pre_install.sh
Applying patch…
Patch successfully applied
新开一个窗口#su – oracle
在登录终端中切换到oracle用户:
在oracle主目录里运行:#/mnt/cdrom/install/linux/runinstaller

*********************************************************
安装过程中的注意事项:
1.在安装中让你输入 UNIX group name:oinstall (#groupadd oinstall)
如果提示orainstRoot.sh权限问题,在root终端下执行:
#sh /tmp/orainstRoot.sh 然后继续
2.在安装中选择 software only 不要建数据库
3. 安装过程中提示/opt/oracle/product/9.2 权限问题,可另开窗口修改权限为oracle-dba
在结束的时候还会提示权限问题,另开窗口修改权限为root-root
注意的是以下几点:
Relink阶段,会出两个错误:ins_oemagent.mk 和 ins_ctx.mk. 点 Ignore 忽略. 不过在我安装的过程中还有一个错误会出现二次ins_rdbms.mk我选择了忽略,如果有人知道这个错误怎么修复请发信件告诉我

再安装过程中,系统会提醒你用root身份去执行两个sh文件,再root的登录终端中按提示操作就可以了
(十) 升级oracle
# su – oracle
安装结束后,HTTPD会自动运行.在升级之前,需要将它停下来.
$ cd $ORACLE_HOME/Apache/Apache/bin
$ ./apachectl stop
./apachectl stop: httpd stopped
LISTENER也需要停下来.
$ lsnrctl stop
LSNRCTL for Linux: Version 9.2.0.1.0 – Production on 07-NOV-2003 16:25:41
Copyright ? 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
The command completed successfully
注意: 如果不停的话,oracle会提示不能覆盖文件.这个时候再去将服务停下来也可以,点Retry就可以了.
(十一) 打补丁
开始打补丁升级.
解包:
# unzip /home/oracle/p3095277_9204_LINUX.zip
Archive: p3095277_9204_LINUX.zip
inflating: 9204_lnx32_release.cpio
inflating: README.html
inflating: patchnote.css
# cpio –idmv < /home/ora9/Disk1/9204_lnx32_release.cpio
做完这个后,再切换到oracle用户控制台, 再次运行/home/oracle/Disk1/runInstaller升级,注意必须先选择最下面的安装选项,安装OUI
要不然没有办法打那个最上面的升级补丁。
升级完OUI后,要退出
$ cd $ORACLE_HOME/bin
$ ./runInstaller
选择第一个选项,将Oracle升级到9.2.0.4。
这时候还是会有一个错误出现ins_oemagent.mk,再次选择忽略它,这个错误会在9.0.2.4补丁包被应用后由3119415_9204_LINUX.zip这个补丁修正。

为了安装 opatch,可以运行:
#su – oracle
$cp p2617419_210_GENERIC.zip /tmp
$cd /tmp
$unzip p2617419_210_GENERIC.zip

在应用补丁 3119415 之前,请确信 oracle 用户可以访问fuser。否则,补丁不能被应用,因为 opatch 要使用 fuser。

为了应用补丁 3119415,可以运行:
#su – oracle
$unzip p3119415_9204_LINUX.zip
$ cd 3119415
$export PATH=$PATH:/tmp/Opatch
$export PATH=$PATH:/sbin # the patch needs “fuser” which is located in /sbin
$which opatch
/tmp/Opatch/opatch
$opatch apply

(十二)创建数据库
现在你可以使用 dbca 创建数据库:
$su – oracle
#dbca

启动和停止 Oracle 9i 数据库 (Startup and Shutdown of the Oracle 9i Database)
1.Sqlplus:
Oracle 9i (9.0.1 & 9.2.0) 不再使用 svrmgrl,而改用 sqlplus。

例如,启动数据库,可以运行下面的命令:
#su – oracle
$sqlplus /nolog
SQL>connect / as sysdba
SQL>startup

斜杠 (/ — slash) 使用 SYS 连接到方案 (schema)。本例中,将使用 SYS 数据库用户以 SYSDBA 身份连接到方案。SYSDBA 赋予用户如下特权:
– sysoper privileges WITH ADMIN OPTION
– create database
– recover database until

立即停止数据库,可以运行下面的命令:
#su – oracle
$sqlplus /nolog
SQL>connect / as sysdba
SQL>shutdown –immediate

2.$ORACLE_HOME/bin/dbstart 和 $ORACLE_HOME/bin/dbshut
也可以使用 $ORACLE_HOME/bin/dbstart 启动数据库,使用 $ORACLE_HOME
/bin/dbshut 停止数据库。甚至可以将 $ORACLE_HOME/bin/dbstart 写入 /etc/rc.d/rc. Local 启动脚本,当系统启动时,自动启动数据库。为了使 $ORACLE_HOME/bin/dbstart 和 $ORACLE_HOME/bin/dbshut 正常工作,需要将 /etc/oratab 文件中第 3 个字段的值由 N 改为 Y。

Oracle RAC 数据库创建过程中的注意事项
· ORA-29807 错误
在数据库创建过程的“创建数据字典视图”阶段中,您将接收到一个 ORA-29807 错误。如果您搜索日志文件,您将看到以下内容:
drop operator XMLSequence
*
ERROR at line 1:
ORA-29807:specified operator does not exist
这是一个已知的问题 (Bug:2686156),并且可被忽略。要继续数据库创建过程,请单击 "Ignore" 按钮:

· ORA-01430 错误
在数据库创建过程的“增加 Oracle Spatial”阶段中,您将接收到一个 ORA-01430 错误。如果您搜索日志文件,您将看到以下内容:
(SDO_ROOT_MBR mdsys.sdo_geometry)
*
ERROR at line 2:
ORA-01430:column being added already exists in table
这是一个已知的问题,并可被忽略。要继续数据库创建过程,请单击 "Ignore"


linux下oracle9i安装:

Oracle公司宣称在Linux下安装Oracle9i数据库至少要有512MB的内存和至少1GB或者两倍    
内存大小的交换空间,对于系统内存大于2GB的服务器,交换空间可以介于2GB—4GB之间。    

如果是为了在一台仅有256M内存的普通PC机上试用Oracle9i,在分配了1GB左右的交换空间的情况下,也可以正常运行Oracle数    
据库。    
要检查内存空间,登录进入Linux,在命令行方式(bash环境)下执行如下命令:    
grep MemTotal /proc/meminfo    
要检查交换空间,在命令行下执行如下命令:    
grep SwapTotal /proc/meminfo

 

1.解压.cpio文件
  #cpio -idvm < lnx_920_disk1.cpio
  #cpio -idvm < lnx_920_disk2.cpio
  #cpio -idvm < lnx_920_disk3.cpio
  在当前目录下生成Disk1和Disk2,Disk3三个目录.
  chmod -R 777 Disk1 Disk2 Disk3
  
2.打补丁
  unzip oraclerpm.zip
  #rpm -ivh *.i586.rpm --nodeps --force

 

3.建立用户和组
  #groupadd dba
  #mkdir /opt/OracleHome
  #adduser -u 499 -d /opt/OracleHome/ -g dba oracle
  注:-u 后可以是1-500(系统用户) -g 添加到私有组dba中
  #chown oracle.dba /opt/OracleHome/
  #mkdir /opt/OracleHome/Ora9i
  #chown oracle.dba /opt/OracleHome/Ora9i
  #touch /etc/rac_on
  #mkdir /opt/tmp
  #chmod 1777 /opt/tmp
  #cp oracle.bashrc /opt/OraclHome/.bashrc
  .basrc中的内容
 export ORACLE_BASE=/opt/OracleHome/
 export ORACLE_HOME=$ORACLE_BASE/Ora9i
 export ORACLE_TERM=xterm
 export ORACLE_SID=fwh
 export ORACLE_LEBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
 export PATH=$PATH:$ORACLE_HOME/bin
 export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/JLIB:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib:$ORACLE_HOME/jre
 export LC_LANG=en_US
 unset LANG
 检测环境变量
 #su -oracle
 $echo $ORACLE_SID

 

4.linux系统优化
  #dd if=/dev/zero of=/opt/tmpswap bs=1k count=1024000
  #chmod 600 /opt/tmpswap
  #mkswap /opt/tmpswap
  #swapon -v /opt/tmpswap
  #sysctl -w kernel.sem="250 32000 100 128"
  #sysctl -w kernel.shmmax=`expr 512 * 1024 * 1024`
 
  #echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf
  #echo "kernel.shmmax=`expr 512 * 1024 * 1024`" >> /etc/sysctl.conf
  注:上两行命令执行后请查看/etc/sysctl.conf的变化.

  #echo 65536 >/proc/sys/fs/file-max
  #ulimit -n 65536
  #ulimit -u 16384
  注:上三行命令是系统优化,建议也添加到/etc/rc.local文件中,每次启动系统自动优化

 

5.安装
  #xhost localhost
  #su - oracle
  #cd /opt/source/Disk1
  #./runInstaller
  指定组
 UNIX GROUP Name:dba
 #cd /tmp
 #./orainstRoot.sh
  指定oracle目录
 Name:ORACLE_HOME
 PATH:同 .basrc中的内容
  选择Database
  选择Enterprise
  选择software Only

 

以下是几点注意事项

然后用命令dbca创建数据库

1.安装时字体问题的解决:
   #unset LANG 
   如果执行上述指令不行的话再修改/root/.i18n和/etc/sysconfig/i18n
   #vi /root/.i18n  
     注:root用户的语言环境,注释掉所有项后添加一行LANG="en_US"
   #vi /etc/sysconfig/i18n  
     注:系统中新增加用户的语言环境(每增加一个用户把它拷贝到其宿主目录生成.i18n)

2.安装过程中的报错:
   前几个按报错信息的指示做,
   只有最后一个/opt/OraclHome/Oracle9i/ctx/lib/下某一文件错,应修改
   /opt/OraclHome/Oracle9i/ctx/lib/env_ctx.mk文件
   在INSO_LINK= 这一行添加一条记录 $(LDLIBFLAG)dl

3.oracle用户SHELL有问题
  #userdel oracle
  #adduser -u 499 -d /opt/OracleHome/ -g dba oracle

小秘籍:

 #hdparm -t /dev/hda 查看硬盘读写速度,如只有2M左右,则执行
 #hdparm -d 1 /dev/hda 开启DMA功能,可把它添加到/etc/rc.local文件中.
 
linux下oracle9i删除:
1.shutdown immediate //停止数据库
2.rm -rf ORACLE_HOME //删除oracle目录
3.rm /etc/ora*  //删除系统中与oracle相关的文件

http://blog.chinaunix.com/opera/showart.php?blogid=11456&id=76912