Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1640322
  • 博文数量: 409
  • 博客积分: 6240
  • 博客等级: 准将
  • 技术积分: 4908
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-01 00:04
文章分类

全部博文(409)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(13)

2015年(22)

2013年(4)

2012年(240)

2011年(127)

分类: LINUX

2011-12-19 22:18:16

leahdizon,我很喜欢
2011-12-19 晚10点整理。
昨天断断续续从中午搞到页面2点,有点影响今天上班了,之前做过一次,但是想再弄一边,就重新安装Oracle。当然还是以下步骤,网上很多,我也是参考别人的。
第一步:安装软件包,没有这些包,那就ok了,不用装了。
compat-db-4.2.52-5.1
compat-libstdc++-296-2.96-138
binutils-2.17.50.0.6-12.el5    
control-center-2.16.0-16.el5
gcc-4.1.2-46.el5
gcc-c++-4.1.2-46.el5
glibc-2.5-42
glibc-common-2.5-42
libstdc++-4.1.2-46.el5
libstdc++-devel-4.1.2-46.el5
make-3.81-3.el5
pdksh-5.2.14-36.el5
sysstat-7.0.2-3.el5
setarch-2.0-1.1
select * from tab where tabtype=upper('table');\
1. cat packets.txt | sed 's/[0-9]*//g'  | sed 's/\.*//g;s/--$//gEGIN{ORS=" "}{print }' | xargs yum -y install


-headers  libaio  libaio-devel  libgcc  libstdc++  libstdc++-devel--e  make  sysstat  unixODBC  unixODBC-devel [root@localhost installoracle]# cat packets.txt | sed 's/[0-9]*//g'  | sed 's/\.*//g;s/--$//gEGIN{ORS=" "}{print }' | xargs yum -y install
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Setting up Install Process
No package binutils--el available.
No package compat-libstdc++ available.
No package elfutils-libelf--el available.
Package libaio-0.3.106-5.i386 already installed and latest version
Package libaio-devel-0.3.106-5.i386 already installed and latest version
No package libstdc++-devel--e available.
Package 1:make-3.81-3.el5.i386 already installed and latest version
Package unixODBC-2.2.11-7.1.i386 already installed and latest version
Package unixODBC-devel-2.2.11-7.1.i386 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package elfutils-libelf-devel.i386 0:0.137-3.el5 set to be updated
--> Processing Dependency: elfutils-libelf-devel-static-i386 = 0.137-3.el5 for package: elfutils-libelf-devel
---> Package gcc.i386 0:4.1.2-51.el5 set to be updated
--> Processing Dependency: cpp = 4.1.2-51.el5 for package: gcc
--> Processing Dependency: libgomp >= 4.1.2-51.el5 for package: gcc
---> Package gcc-c++.i386 0:4.1.2-51.el5 set to be updated
--> Processing Dependency: libstdc++-devel = 4.1.2-51.el5 for package: gcc-c++
--> Processing Dependency: glibc = 2.5-49 for package: nscd
---> Package glibc.i686 0:2.5-65.el5_7.1 set to be updated
---> Package glibc-common.i386 0:2.5-65.el5_7.1 set to be updated
---> Package glibc-devel.i386 0:2.5-65.el5_7.1 set to be updated
---> Package glibc-headers.i386 0:2.5-65.el5_7.1 set to be updated
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers
--> Processing Dependency: kernel-headers for package: glibc-headers
---> Package libgcc.i386 0:4.1.2-51.el5 set to be updated
---> Package libstdc++.i386 0:4.1.2-51.el5 set to be updated
---> Package sysstat.i386 0:7.0.2-11.el5 set to be updated
--> Running transaction check
---> Package cpp.i386 0:4.1.2-51.el5 set to be updated
---> Package elfutils-libelf-devel-static.i386 0:0.137-3.el5 set to be updated
---> Package kernel-headers.i386 0:2.6.18-274.12.1.el5 set to be updated
---> Package libgomp.i386 0:4.4.4-13.el5 set to be updated
---> Package libstdc++-devel.i386 0:4.1.2-51.el5 set to be updated
addons/filelists                                                                        |  195 B     00:00     
base/filelists                                                                          | 2.9 MB     00:01     
extras/filelists_db                                                                     | 199 kB     00:00     
updates/filelists_db                                                                    | 1.6 MB     00:01     
---> Package nscd.i386 0:2.5-65.el5_7.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================
 Package                                Arch           Version                         Repository         Size
===============================================================================================================
Installing:
 elfutils-libelf-devel                  i386           0.137-3.el5                     base               24 k
 gcc                                    i386           4.1.2-51.el5                    base              5.2 M
 gcc-c++                                i386           4.1.2-51.el5                    base              3.4 M
 glibc-devel                            i386           2.5-65.el5_7.1                  updates           2.0 M
 glibc-headers                          i386           2.5-65.el5_7.1                  updates           604 k
 sysstat                                i386           7.0.2-11.el5                    base              182 k
Updating:
 glibc                                  i686           2.5-65.el5_7.1                  updates           5.3 M
 glibc-common                           i386           2.5-65.el5_7.1                  updates            16 M
 libgcc                                 i386           4.1.2-51.el5                    base               96 k
 libstdc++                              i386           4.1.2-51.el5                    base              362 k
Installing for dependencies:
 elfutils-libelf-devel-static           i386           0.137-3.el5                     base               66 k
 kernel-headers                         i386           2.6.18-274.12.1.el5             updates           1.2 M
 libgomp                                i386           4.4.4-13.el5                    base               72 k
 libstdc++-devel                        i386           4.1.2-51.el5                    base              2.8 M
Updating for dependencies:
 cpp                                    i386           4.1.2-51.el5                    base              2.7 M
 nscd                                   i386           2.5-65.el5_7.1                  updates           169 k

Transaction Summary
===============================================================================================================
Install      10 Package(s)
Upgrade       6 Package(s)

Total download size: 41 M
Downloading Packages:
(1/16): elfutils-libelf-devel-0.137-3.el5.i386.rpm                                      |  24 kB     00:00     
(2/16): elfutils-libelf-devel-static-0.137-3.el5.i386.rpm                               |  66 kB     00:00     
(3/16): libgomp-4.4.4-13.el5.i386.rpm                                                   |  72 kB     00:00     
(4/16): libgcc-4.1.2-51.el5.i386.rpm                                                    |  96 kB     00:00     
(5/16): nscd-2.5-65.el5_7.1.i386.rpm                                                    | 169 kB     00:00     
(6/16): sysstat-7.0.2-11.el5.i386.rpm                                                   | 182 kB     00:00     
(7/16): libstdc++-4.1.2-51.el5.i386.rpm                                                 | 362 kB     00:00     
(8/16): glibc-headers-2.5-65.el5_7.1.i386.rpm                                           | 604 kB     00:00     
(9/16): kernel-headers-2.6.18-274.12.1.el5.i386.rpm                                     | 1.2 MB     00:00     
(10/16): glibc-devel-2.5-65.el5_7.1.i386.rpm                                            | 2.0 MB     00:02     
(11/16): cpp-4.1.2-51.el5.i386.rpm                                                      | 2.7 MB     00:01     
(12/16): libstdc++-devel-4.1.2-51.el5.i386.rpm                                          | 2.8 MB     00:02     
(13/16): gcc-c++-4.1.2-51.el5.i386.rpm                                                  | 3.4 MB     00:03     
(14/16): gcc-4.1.2-51.el5.i386.rpm                                                      | 5.2 MB     00:03     
(15/16): glibc-2.5-65.el5_7.1.i686.rpm                                                  | 5.3 MB     00:05     
(16/16): glibc-common-2.5-65.el5_7.1.i386.rpm                                           |  16 MB     00:13     
---------------------------------------------------------------------------------------------------------------
Total                                                                          1.2 MB/s |  41 MB     00:34     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : glibc-common                                                                           1/22 
  Installing     : kernel-headers                                                                         2/22 
  Updating       : libgcc                                                                                 3/22 
  Updating       : glibc                                                                                  4/22 
  Updating       : libstdc++                                                                              5/22 
  Installing     : libgomp                                                                                6/22 
  Updating       : cpp                                                                                    7/22 
  Installing     : sysstat                                                                                8/22 
  Updating       : nscd                                                                                   9/22 
  Installing     : libstdc++-devel                                                                       10/22 
  Installing     : glibc-headers                                                                         11/22 
  Installing     : glibc-devel                                                                           12/22 
  Installing     : gcc                                                                                   13/22 
  Installing     : gcc-c++                                                                               14/22 
  Installing     : elfutils-libelf-devel                                                                 15/22 
  Installing     : elfutils-libelf-devel-static                                                          16/22 
  Cleanup        : libgcc                                                                                17/22 
  Cleanup        : glibc                                                                                 18/22 
  Cleanup        : libstdc++                                                                             19/22 
  Cleanup        : cpp                                                                                   20/22 
  Cleanup        : glibc-common                                                                          21/22 
  Cleanup        : nscd                                                                                  22/22 

Installed:
  elfutils-libelf-devel.i386 0:0.137-3.el5  gcc.i386 0:4.1.2-51.el5              gcc-c++.i386 0:4.1.2-51.el5 
  glibc-devel.i386 0:2.5-65.el5_7.1         glibc-headers.i386 0:2.5-65.el5_7.1  sysstat.i386 0:7.0.2-11.el5 

Dependency Installed:
  elfutils-libelf-devel-static.i386 0:0.137-3.el5           kernel-headers.i386 0:2.6.18-274.12.1.el5          
  libgomp.i386 0:4.4.4-13.el5                               libstdc++-devel.i386 0:4.1.2-51.el5                

Updated:
  glibc.i686 0:2.5-65.el5_7.1         glibc-common.i386 0:2.5-65.el5_7.1       libgcc.i386 0:4.1.2-51.el5      
  libstdc++.i386 0:4.1.2-51.el5      

Dependency Updated:
  cpp.i386 0:4.1.2-51.el5                              nscd.i386 0:2.5-65.el5_7.1                             

Complete!
[root@localhost installoracle]# 

-----------------------------------------------------------------
执行runinstall
[oracle@localhost database]$ ll 
total 28
drwxr-xr-x 9 root root 4096 Jul  3  2005 doc
drwxr-xr-x 5 root root 4096 Jul  3  2005 install
drwxr-xr-x 2 root root 4096 Jul  3  2005 response
-rwxr-xr-x 1 root root 1327 Jul  3  2005 runInstaller
drwxr-xr-x 9 root root 4096 Jul  3  2005 stage
-rwxr-xr-x 1 root root 5213 Jul  3  2005 welcome.html
[oracle@localhost database]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
                                      Failed <<<<

Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2011-12-18_05-22-10PM/installActions2011-12-18_05-22-10PM.log
[oracle@localhost database]$ uname -a
Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:35 EDT 2010 i686 i686 i386 GNU/Linux
第二步:创建目录、用户和修改系统配置文件:
创建oracle所需要的用户名(oracle)和组名(oinstall、dba),并设置相应的权限:

 

[root@oracle ~]# /usr/sbin/groupadd oinstall

[root@oracle ~]# /usr/sbin/groupadd dba

[root@oracle ~]# /usr/sbin/useradd -g oinstall -G dba oracle

[root@oracle ~]# passwd oracle 

[root@oracle ~]# mkdir -p /u01/app/oracle/product/         
 
[root@oracle ~]# chown -R oracle:oinstall /u01           
[root@oracle ~]# chmod -R 775 /u01

 接下来修改系统配置:

vi /etc/sysctl.conf

 

在最末尾的地方加上:

 

kernel.shmall = 2097152                       //固定大小为2M

kernel.shmmax = 2147483648                     //一般设置为物理的一半

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 262144
[root@oracle ~]# /sbin/sysctl -p                     //使修改后的配置文件生效


为 oracle 用户设置 Shell 限制                            //这一步很重要

[root@oracle ~]# vi /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

[root@oracle ~]# 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

 

[root@oracle ~]# vi /etc/csh.login

 

if ( $USER == "oracle" ) then

        limit maxproc 16384

         limit deors 65536

endif

关闭selinux
[root@oracle ~]# vi /etc/selinux/config

 

# 设置SELINUX为disabled

      SELINUX=disabled

 

       修改系统的发行版本

 

[root@oracle ~]# vi /etc/redhat-release

 

将CentOS release 5 (Final) 修改成

Red Hat Enterprise Linux AS release 5 

修改Oracle环境变量:
[oracle@localhost ~]$ cat ~/.bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=orcl
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0.1/db_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@localhost ~]$ 

第三步:解压安装,再插一句,系统硬盘至少15GB,麻痹我弄个10GB,结果安装的时候老报错,说磁盘空间不足,悲剧的哥。。。就不说了,丢人。。。
解压之后进入安装目录,执行:
[oracle@localhost admin]$ cd /u01/database/
//抱那个display错误,执行export DISPLAY=:0.0 就可以了//新浪微薄redhat
[oracle@localhost database]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
                                      Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-12-18_05-23-15PM. Please wait ...[oracle@localhost database]$ Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2011-12-18_05-23-15PM/jre/1.4.2/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(Unknown Source)
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.loadLibrary0(Unknown Source)
        at java.lang.System.loadLibrary(Unknown Source)
        at sun.security.action.LoadLibraryAction.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.NativeLibLoader.loadLibraries(Unknown Source)
        at sun.awt.DebugHelper.(Unknown Source)
        at java.awt.Component.(Unknown Source)


//修改/etc/redhat-release ,开始我设置的是Red Hat Enterprise Linux AS release 5
Red Hat Enterprise Linux AS release 4 
//没分配好权限
[oracle@localhost database]$ ll
total 28
drwxr-xr-x 9 root root 4096 Jul  3  2005 doc
drwxr-xr-x 5 root root 4096 Jul  3  2005 install
drwxr-xr-x 2 root root 4096 Jul  3  2005 response
-rwxr-xr-x 1 root root 1327 Jul  3  2005 runInstaller
drwxr-xr-x 9 root root 4096 Jul  3  2005 stage
-rwxr-xr-x 1 root root 5213 Jul  3  2005 welcome.html
[oracle@localhost database]$ 
执行chown和chmod  还是不行,后来上网看,发现缺包。。。
[root@localhost u01]# ll  /tmp/OraInstall2011-12-18_05-27-38PM/jre/1.4.2/lib/i386/libawt.so 
-rwxr-xr-x 1 oracle oinstall 3059052 Apr  6  2005 /tmp/OraInstall2011-12-18_05-27-38PM/jre/1.4.2/lib/i386/libawt.so
[root@localhost u01]# yum -y install libXp
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.ustc.edu.cn
 * extras: centos.ustc.edu.cn
 * updates: centos.ustc.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libXp.i386 0:1.0.0-8.1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================
 Package                 Arch                   Version                           Repository              Size
===============================================================================================================
Installing:
 libXp                   i386                   1.0.0-8.1.el5                     base                    23 k

Transaction Summary
===============================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 23 k
Downloading Packages:
libXp-1.0.0-8.1.el5.i386.rpm                                                            |  23 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libXp                                                                                   1/1 

Installed:
  libXp.i386 0:1.0.0-8.1.el5                                                                                   

Complete!
[root@localhost u01]# 
install过程中报错,提示为磁盘空间不足,删除/opt/oracle。然后输入retry,可以继续安装,我的vm设置的是10GB的空间,网上说的硬盘至少为15GB不知道是否是这个原因,不清楚为啥会用到那么多空间,我df -h

[root@localhost u01]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      7.7G  7.3G     0 100% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 506M     0  506M   0% /dev/shm
[root@localhost u01]# cd /u01/
[root@localhost u01]# du -sh /u01/
1.9G /u01/
[root@localhost u01]# rm -f /opt/yksoftware/10201_database_linux32.zip 
[root@localhost u01]# 
空间还不够,草。。。

/tmp/OraInstall2011-12-18_05-27-38PM/jre/1.4.2/lib/i386/libawt.so: libXp.so.
重新继续搞。。。
[oracle@localhost u01]$ cd database/
[oracle@localhost database]$ ./runInstaller 
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
                                      Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-12-18_07-51-34PM. Please wait ...[oracle@localhost database]$ Starting Installer in advanced mode ...
Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

Starting Installer in advanced mode ...
Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

Starting Installer in advanced mode ...
Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

Starting Installer in advanced mode ...
Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.
//perfect!
按照网上说的,先不创建数据,只安装软件,安装完毕之后:

[oracle@localhost database]$ netca
netca            netca_deinst.sh  
[oracle@localhost database]$ netca
netca            netca_deinst.sh  
[oracle@localhost database]$ netca

Oracle Net Services Configuration:
Oracle Net Services configuration terminated by user.  The exit code is -1

[oracle@localhost database]$
//perfect!
再:
[oracle@localhost database]$ dbca 
[oracle@localhost database]$ netca
netca            netca_deinst.sh  
[oracle@localhost database]$ netca

Oracle Net Services Configuration:
Configuring Listener:LISTENER1
Listener configuration complete.
Oracle Net Listener Startup:
    Running Listener Control: 
      /u01/app/oracle/product/10.2.0.1/db_1/bin/lsnrctl start LISTENER1
    Listener Control complete.
    Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0
[oracle@localhost database]$ 
//perfect!

/* 这部分可以不看,哥弄出问题了,最后删除db和监听,重新配置,所以才花我那么多时间,归结于麻痹出的磁盘空间,导致了一系列的问题,我搞了晚上2点。。。what a fucking day!
[oracle@localhost database]$ sqlplus
sqlplus   sqlplusO  
[oracle@localhost database]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 18 22:02:58 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn /as sysdba;
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/10.2.0.1/db_1/dbs/initorcl.ora'
SQL> select instance_name from v$instance;
select instance_name from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available


SQL> quit
Disconnected
[oracle@localhost ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@localhost ~]$ echo $ORACLE_SID
oracle10g
[oracle@localhost ~]$ cp /u01/app/oracle/admin/or
oracle10g/ orcl/      
[oracle@localhost ~]$ cp /u01/app/oracle/admin/or
oracle10g/ orcl/      
[oracle@localhost ~]$ cp /u01/app/oracle/admin/oracle10g/pfile/init.ora.11182011212556 /u01/app/oracle/product/10.2.0.1/db_1/dbs/init
initdw.ora  init.ora    
[oracle@localhost ~]$ cp /u01/app/oracle/admin/oracle10g/pfile/init.ora.11182011212556 /u01/app/oracle/product/10.2.0.1/db_1/dbs/initorcl.ora
[oracle@localhost ~]$ cat /u01/app/oracle/product/10.2.0.1/db_1/dbs/initorcl.ora
##################
[oracle@localhost database]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 18 22:15:57 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn /as sysdba;
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              92276304 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode


SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl

SQL> 
SQL> shutdown
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> 
SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@localhost database]$ 
[oracle@localhost database]$ whereis sqlplus0
sqlplus0:
[oracle@localhost database]$ which sqlpus
/usr/bin/which: no sqlpus in (/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/oracle/bin:/u01/app/oracle/product/10.2.0.1/db_1/bin)
[oracle@localhost database]$ which sqlpus0
/usr/bin/which: no sqlpus0 in (/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/oracle/bin:/u01/app/oracle/product/10.2.0.1/db_1/bin)
[oracle@localhost database]$ type sqlplus
sqlplus is hashed (/u01/app/oracle/product/10.2.0.1/db_1/bin/sqlplus)
[oracle@localhost database]$ type sqlplus0
bash: type: sqlplus0: not found
[oracle@localhost database]$ 

[oracle@localhost database]$ netca

Oracle Net Services Configuration:
Configuring Listener:LISTENER
Default local naming configuration complete.
Listener configuration complete.
The information provided for this listener is currently in use by other software on this computer. 
    Listener start failed. Listener may already be running.
Oracle Net Services configuration successful. The exit code is 0



[oracle@localhost database]$ 
*/
[oracle@localhost admin]$ cd /u01/database/
[oracle@localhost database]$ cd $ORACLE_HOME
[oracle@localhost db_1]$ cd network/admin/
[oracle@localhost admin]$ ls
listener11121810PM5718.bak  sqlnet1112189PM5019.bak
listener1112189PM5019.bak   sqlnet.log
listener.ora                sqlnet.ora
listener.ora.bak            tnsnames11121810PM5718.bak
samples                     tnsnames1112189PM5019.bak
shrept.lst                  tnsnames.ora
sqlnet11121810PM5718.bak    tnsnames.ora.bak
[oracle@localhost admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0.1/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PL***tProc)
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0.1/db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

[oracle@localhost admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0.1/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PL***tProc)
      (PRESENTATION = RO)
    )
  )

[oracle@localhost admin]$ 

[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Dec 19 22:42:04 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn /as sysdba;
Connected to an idle instance.
SQL> 

SQL> select instance_name from v$instance;
select instance_name from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available


SQL>
SQL>startup
//执行结果
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl

SQL> show parameter service_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names     
SQL> select object_name from dba_objects where owner=upper('system') and 

object_type=upper('table');

OBJECT_NAME
--------------------------------------------------------------------------------
MVIEW$_ADV_WORKLOAD
MVIEW$_ADV_BASETABLE
MVIEW$_ADV_SQLDEPEND
MVIEW$_ADV_PRETTY
MVIEW$_ADV_TEMP
MVIEW$_ADV_FILTER
MVIEW$_ADV_LOG
MVIEW$_ADV_FILTERINSTANCE
MVIEW$_ADV_LEVEL
MVIEW$_ADV_ROLLUP
MVIEW$_ADV_AJG

OBJECT_NAME
--------------------------------------------------------------------------------
MVIEW$_ADV_FJG
MVIEW$_ADV_GC
MVIEW$_ADV_CLIQUE
MVIEW$_ADV_ELIGIBLE
MVIEW$_ADV_OUTPUT
MVIEW$_ADV_EXCEPTIONS
MVIEW$_ADV_PARAMETERS
MVIEW$_ADV_INFO
MVIEW$_ADV_JOURNAL
MVIEW$_ADV_PLAN
AQ$_QUEUE_TABLES

OBJECT_NAME
--------------------------------------------------------------------------------
AQ$_QUEUES
AQ$_SCHEDULES
AQ$_INTERNET_AGENTS
AQ$_INTERNET_AGENT_PRIVS
DEF$_AQCALL
DEF$_AQERROR
DEF$_ERROR
DEF$_DESTINATION
DEF$_CALLDEST
DEF$_DEFAULTDEST
DEF$_LOB

OBJECT_NAME
--------------------------------------------------------------------------------
DEF$_TEMP$LOB
DEF$_PROPAGATOR
DEF$_ORIGIN
DEF$_PUSHED_TRANSACTIONS
OL$
OL$HINTS
OL$NODES
LOGMNR_SESSION_EVOLVE$
LOGMNR_HEADER1$
LOGMNR_HEADER2$
LOGMNR_UID$

OBJECT_NAME
--------------------------------------------------------------------------------
LOGMNRC_DBNAME_UID_MAP
LOGMNR_DICTSTATE$
LOGMNR_DICTIONARY$
LOGMNR_OBJ$
LOGMNR_USER$
LOGMNRC_GTLO
LOGMNRC_GTCS
LOGMNRC_GSII
LOGMNR_TAB$
LOGMNR_COL$
LOGMNR_ATTRCOL$

OBJECT_NAME
--------------------------------------------------------------------------------
LOGMNR_TS$
LOGMNR_IND$
LOGMNR_TABPART$
LOGMNR_TABSUBPART$
LOGMNR_TABCOMPART$
LOGMNR_TYPE$
LOGMNR_COLTYPE$
LOGMNR_ATTRIBUTE$
LOGMNR_LOB$
LOGMNR_CDEF$
LOGMNR_CCOL$

OBJECT_NAME
--------------------------------------------------------------------------------
LOGMNR_ICOL$
LOGMNR_LOBFRAG$
LOGMNR_INDPART$
LOGMNR_INDSUBPART$
LOGMNR_INDCOMPART$
LOGMNRP_CTAS_PART_MAP
LOGMNRT_MDDL$
LOGMNR_LOG$
LOGMNR_PROCESSED_LOG$
LOGMNR_SPILL$
LOGMNR_AGE_SPILL$

OBJECT_NAME
--------------------------------------------------------------------------------
LOGMNR_RESTART_CKPT_TXINFO$
LOGMNR_ERROR$
LOGMNR_RESTART_CKPT$
LOGMNR_FILTER$
LOGMNR_PARAMETER$
LOGMNR_SESSION$
LOGSTDBY$PARAMETERS
LOGSTDBY$EVENTS
LOGSTDBY$APPLY_PROGRESS
LOGSTDBY$APPLY_MILESTONE
LOGSTDBY$SCN

OBJECT_NAME
--------------------------------------------------------------------------------
LOGSTDBY$PLSQL
LOGSTDBY$SKIP_TRANSACTION
LOGSTDBY$SKIP
LOGSTDBY$SKIP_SUPPORT
LOGSTDBY$HISTORY
REPCAT$_REPCAT
REPCAT$_FLAVORS
REPCAT$_REPSCHEMA
REPCAT$_SNAPGROUP
REPCAT$_REPOBJECT
REPCAT$_REPCOLUMN

OBJECT_NAME
--------------------------------------------------------------------------------
REPCAT$_KEY_COLUMNS
REPCAT$_GENERATED
REPCAT$_REPPROP
REPCAT$_REPCATLOG
REPCAT$_DDL
REPCAT$_REPGROUP_PRIVS
REPCAT$_PRIORITY_GROUP
REPCAT$_PRIORITY
REPCAT$_COLUMN_GROUP
REPCAT$_GROUPED_COLUMN
REPCAT$_CONFLICT

OBJECT_NAME
--------------------------------------------------------------------------------
REPCAT$_RESOLUTION_METHOD
REPCAT$_RESOLUTION
REPCAT$_RESOLUTION_STATISTICS
REPCAT$_RESOL_STATS_CONTROL
REPCAT$_PARAMETER_COLUMN
REPCAT$_AUDIT_ATTRIBUTE
REPCAT$_AUDIT_COLUMN
REPCAT$_FLAVOR_OBJECTS
REPCAT$_TEMPLATE_STATUS
REPCAT$_TEMPLATE_TYPES
REPCAT$_REFRESH_TEMPLATES

OBJECT_NAME
--------------------------------------------------------------------------------
REPCAT$_USER_AUTHORIZATIONS
REPCAT$_OBJECT_TYPES
REPCAT$_TEMPLATE_REFGROUPS
REPCAT$_TEMPLATE_OBJECTS
REPCAT$_TEMPLATE_PARMS
REPCAT$_OBJECT_PARMS
REPCAT$_USER_PARM_VALUES
REPCAT$_TEMPLATE_SITES
REPCAT$_SITE_OBJECTS
REPCAT$_RUNTIME_PARMS
REPCAT$_TEMPLATE_TARGETS

OBJECT_NAME
--------------------------------------------------------------------------------
REPCAT$_EXCEPTIONS
REPCAT$_INSTANTIATION_DDL
REPCAT$_EXTENSION
REPCAT$_SITES_NEW
SQLPLUS_PRODUCT_PROFILE
HELP
MVIEW$_ADV_INDEX
MVIEW$_ADV_PARTITION
MVIEW$_ADV_OWB

141 rows selected.

SQL> create table system.yangkaisys (name char(4),city char(8),id int );

Table created.

SQL> insert system.yangkaisys values('yangkai','shanghai','001');
insert system.yangkaisys values('yangkai','shanghai','001')
       *
ERROR at line 1:
ORA-00925: missing INTO keyword


SQL> insert into system.yangkaisys values('yangkai','shanghai','001');
insert into system.yangkaisys values('yangkai','shanghai','001')
                                     *
ERROR at line 1:
ORA-12899: value too large for column "SYSTEM"."YANGKAISYS"."NAME" (actual: 7,
maximum: 4)


SQL> alter table system.yangkaisys modify name char(32) not null;

Table altered.

SQL> insert into system.yangkaisys values('yangkai','shanghai','001');

1 row created.

SQL> select * from system.yangkaisys;

NAME                             CITY             ID
-------------------------------- -------- ----------
yangkai                          shanghai          1

SQL> 
SQL> select * from system.yangkaisys;

NAME                             CITY             ID
-------------------------------- -------- ----------
yangkai                          shanghai          1

                   string      orcl
SQL> shutdown immediate;
ORA-01097: cannot shutdown while in a transaction - commit or rollback first
SQL> commit;

Commit complete.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 

SQL> quit 
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 

Production
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~]$
-----------------------------------------------------------------------------------
安装vm CentOS,语言美国,en_US.UTF-8,自动分区,不是选择删除,建立默认分区,总磁盘

20GB,opt10g,boot 400MB,还有默认的lovv之类的。
________________________________
该装的那些软件包必须得安装!!!
__________________________________________
1.安装到最后,配置监听,在Oracle用户下,执行netca 命令,也是图形界面,基本默认。配

置完毕,ps -ef查看是否成功。
2.然后执行dbca命令,创建数据库,也是图形界面。全局数据库名和sid必须一样!!!不要改

配置文件。这步后面,memory,要设置字符集character,选择uft-8
3.sqlplus /nolog
conn /as sysdba;
提示:connected to an idle instance,这是因为Oracle未启动,这时要执行startup.
conn 之后,可以直接创建表,但是不知道这个表是哪个用户的,sysdba?
插入数据之后,要输入commit命令进行提交。
执行完之后,要commit本想再插入几张美女图,但是昨晚发的图片都被管理给删了,我就不传了,上个测试区拉个屎,准备睡觉,快过年了,项目很紧,老板很着急。。。
阅读(2413) | 评论(0) | 转发(0) |
0

上一篇:yum的用法(待续)

下一篇:醒世恒言

给主人留下些什么吧!~~