之前学姐在公司DBA私服上装过一台Oracle 10G 昨天想起来要装Informatica 索性就想把这个台尘封已久的文物弄醒。
首先第一个问题,怎么run起来!!! SVN上有学姐和其他前辈的文档,其中有一篇就是安装文档,找到如下密码。
10.1 启动服务
监听器接受客户端得连接请求 并验证创建数据库连接
[oracle@TSM54-Test database]$ lsnrctl status
启动和停止服务
[oracle@TSM54-Test database]$ lsnrctl start
[oracle@TSM54-Test database]$ lsnrctl stop
启动和停止OEM 服务
[oracle@TSM54-Test database]$emctl start dbconsole
[oracle@TSM54-Test database]$emctl stop dbconsole
10.2 访问web数据库页面
浏览器中输入http://localhost.localdomain:1158/em
10.3 启动和停止数据库
[oracle@TSM54-Test database]$isqlplusctl start
[oracle@TSM54-Test database]$isqlplusctl stop
这就ok了 启动sqlplus Enter user-name:/ as sysdba 接着Startup Ok 显示正常。
第一个事情 先给自己创建一个小号(怪癖,讨厌拿admin root啥的乱窜 木有个性 木有Style)
先创建TableSpaces吧
create temporary tablespace ipquery_temp tempfile '/home/oracle/oradata/ipquery_temp01.dbf' size 64m autoextend on next 64m maxsize 2048m extent management local ;
create tablespace ipquery_data logging datafile '/home/oracle/oradata/ipquery_data01.dbf' size 64m autoextend on next 64m maxsize 2048m extent management local;
接着创建User 并指派到刚新建的TableSpaces里
create user woody identified by woodyxu default tablespace ipquery_data temporary tablespace ipquery_temp;
接着实验该帐号,登陆..被拒接..尼玛 忘加权限了..
grant connect,resource to woody;
grant unlimited tablespace to woody; -- 授予不限制的表空间 何必呢!
grant select any table to woody; -- //授予查询任何表
登陆..报错..
ORA-01013: user requested cancel of current operation
貌似是超时了,于是乎。
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
然后用Woody这个Account登陆 接着 还是报错
ORA-00257: archiver error. Connect internal only, until freed.
Google了一下原来这台Oracle开启了归档模式,于是乎产生了一坨一坨的ArchiveLog,默认木有定时删除Log的这个步骤(这点和PostgreSQL有一比)
先查一下占用了多少空间
SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE 0 0 0
ONLINELOG 0 0 0
ARCHIVELOG 98.06 0 2
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG 0 0 0
好吧..进RMAN删
[oracle@mysql-test ~]$ RMAN target sys/******
crosscheck archivelog all;
delete expired archivelog all; // Do you really want to delete the above objects (enter YES or NO)? yes
// 或者只保留7天内的Log 其余全删
RMAN> DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=151 devtype=DISK
specification does not match any archive log in the recovery catalog
RMAN> list archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
51 1 171 A 05-JUN-11 /usr/local/oracle/flash_recovery_area/ORCL/archivelog/2012_05_09/o1_mf_1_171_7tnjdsdr_.arc
52 1 172 A 05-JUN-11 /usr/local/oracle/flash_recovery_area/ORCL/archivelog/2012_05_09/o1_mf_1_172_7tnjdvbc_.arc
RMAN> list expired archivelog all;
specification does not match any archive log in the recovery catalog
RMAN> exit
Sysdba进去再Show一下空间剩余,OK了,重启服务,用小号登陆,一切正常。