本篇文章简绍了oracle安装后的本地登陆和远程登陆。
本地登陆
这个表示以管理登陆
[oracle@huang11 ~]$ sqlplus "/ as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:47:37 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
[oracle@huang11 ~]$ sqlplus "/nolog"  这个表示不用身份登陆
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:48:53 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn  / as sysdba    这个表示连接到管理原,如果是普通用户可conn 用户/密码
Connected.
SQL>
远程登陆。
远程登陆登陆没有实列时我们要看是否能tnsping 这个事列。
[oracle@huang11 ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 22-DEC-2009 18:50:54
Copyright (c) 1997, 2005, Oracle.  All rights reserved.
Used parameter files:
/sof/oracle/10g/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = huang11.huang.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))     这个端口远程连接要用的。
OK (0 msec)   看到ok就表示成功了。
如果看到下面这种就表示不能tnsping通。
[oracle@huang11 ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 25-DEC-2009 09:25:53
Copyright (c) 1997, 2005, Oracle.  All rights reserved.
Used parameter files:
/sof/oracle/10g/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = huang11.huang.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
TNS-12541: TNS:no listener
原因是没有启动网络监听。
[oracle@huang11 ~]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 25-DEC-2009 09:26:27
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Starting /sof/oracle/10g/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
就可以了。
下面我们在看是否能tnsping通了。
下面表示成功了。
[oracle@huang11 ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 25-DEC-2009 09:26:58
Copyright (c) 1997, 2005, Oracle.  All rights reserved.
Used parameter files:
/sof/oracle/10g/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = huang11.huang.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (10 msec)
下面是远程登陆本地的orcl事列
[oracle@huang11 ~]$ sqlplus sys/oracle@orcl as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:50:23 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
sys  这个是DBA的用户
oracle   sys 用户密码
orcl   网络服务名 默认就是sid   这个就是tnsnames.ora   lisener.ora定义出来的。
要远程登录 我们一定tnsping  orclping通才可以登录。
这个就是远程登陆192.168.27.11上面的orcl这个事列
[oracle@huang11 ~]$ sqlplus sys/oracle@192.168.27.11:1521/orcl as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:53:25 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
下面就是以普通用户身份登陆。
[oracle@huang11 ~]$ sqlplus system/oracle@orcl
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:54:24 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
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@huang11 ~]$ sqlplus system/oracle@192.168.27.11:1521/orcl
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:54:44 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
要装好后就有sys system  sysman dbsnmp这个几个用户密码默认都是oracle安装的时候设定的
下面是忘记了sys的密码的修改方法。
[oracle@huang11 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Dec 22 18:58:43 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> alter user sys identified by oracle;  这种方法适合改任何人的密码。
User altered.
用这种方法也可以修改sys的密码
[oracle@huang11 ~]$ cd $ORACLE_HOME/dbs
[oracle@huang11 dbs]$ rm orapworcl  orapw是不变的 orcl这个就是事列
[oracle@huang11 dbs]$ orapwd file=orapworcl  password=oracle