Skip to content

Commit 730dda5

Browse files
committed
Add oracle guides
1 parent 9ca3822 commit 730dda5

10 files changed

+1245
-0
lines changed

Oracle/Administer Oracle 9i RAC.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Administer Oracle 9i RAC
2+
**Need to know**:
3+
4+
* Database Name
5+
* Instance Name
6+
* pfile location
7+
* Storage Method (ASM/Filesystem)
8+
9+
10+
**Use SRVCTL to verify database/instance**:
11+
* Obtain the status of GSD `gsdctl status`
12+
* First run the GSD and listener
13+
```
14+
%ORACLE_HOME%\bin\gsdctl start
15+
%ORACLE_HOME%\bin\lsnrctl start
16+
```
17+
* List configuration of the instance & database:
18+
```
19+
srvctl config instance
20+
srvctl config database
21+
srvctl config database -d dbname
22+
```
23+
* To list all environment variables for a database: `srvctl getenv database -d mydb`
24+
* List DB and instance status
25+
```
26+
srvctl status database -d database_name
27+
srvctl status instance -d mydb -i mydb1,mydb2
28+
```
29+
* start/stop db
30+
```
31+
srvctl start database -d mydb (-i iname - optionally)
32+
srvctl stop database -d mydb
33+
```
34+
35+
**IF everything fails try**
36+
37+
Start `OracleServicesid` instance on each node. `C:\> net start OracleServicesid`
38+
39+
From the Control Panel's Services window, select `OracleServicesid`, then click `Start`.
40+
41+
If the listener is not started, start it on each of the nodes
42+
```
43+
LSNRCTL
44+
LSNRCTL> start [listener_name]
45+
```
46+
47+
Where `listener_name` is the name of the listener defined in the `listener.ora` file.
48+
49+
You do not have to identify the listener if you are using the default listener named LISTENER.
50+
```
51+
sqlplus /nolog
52+
CONNECT SYS\password
53+
STARTUP PFILE=%ORACLE_HOME%\database\initsid.ora;
54+
```
55+
56+
## Export the database
57+
58+
Once the database is open, ensure that EXP_FULL_DATABASE and is assigned to DBA role
59+
```sql
60+
SELECT * FROM DBA_SYS_PRIVS;
61+
SELECT * FROM DBA_ROLE_PRIVS;
62+
```
63+
64+
If the role does not exist then run `catproc.sql` and `catalog.sql`
65+
66+
Ensure the SYSTEM user has the DBA role assigned
67+
C:\>EXP system/manager FULL=y FILE=export.dmp
68+
69+
SOS: IF stored procedures exists, they cannot be migrated to MySQL!!!!
70+
```sql
71+
SELECT * FROM ALL_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE','PACKAGE');
72+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# How to auto startup Oracle 10g/11g on Linux Systems
2+
3+
If you have installed 11g using the Grid Infrastructure (either for a single node or a RAC environment), then you do not need to worry for autostartup, as Grid Infrastructure installs a service called Oracle Restart, which does exactly that, the automatic startup of Oracle processes whenever they fail or the system reboots.
4+
5+
If you have installed 10g or 11g (Without using the Grid Infrastructure option then you need to):
6+
http://www.oracle-base.com/articles/linux/AutomatingDatabaseStartupAndShutdownOnLinux.php

Oracle/Export and Import Methods.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Export and Import Methods
2+
3+
## Export schema and import to a new tablespace on the same DB
4+
You cannot move the whole schema from one tablespace to another, especially if you have LOBs. What you need to do is either transfer only the data (without the LOBs), which is too much of a trouble and you may loose some information unless you are extremely careful. Or you can export the schema you want to move to another tablespace, delete the objects of that schema and import the objects to new tablespace. In order to export a schema and import it to the same database but to new tablespace you need to:
5+
6+
* **Create the new tablespace(s)** with the appropriate datafiles. We are going to create a test tablespace with starting with 10G of space and it will be auto-extendable. The auto-extend will occur every 250M and the maximum size will be unlimited.
7+
```
8+
sql> create tablespace tablespace_name datafile 'path_to_file/filename.dbf'
9+
> size 10G autoextend on next 250m maxsize unlimited extent management local;
10+
```
11+
* Create a directory on the filesystem that will hold the dump files of export/import procedure.
12+
```
13+
$ mkdir /path_to_dir/exp_dir
14+
```
15+
* Register the directory to the database and give permissions to a db user in order to be able to export/import objects.
16+
```
17+
sql> create or replace directory new_imp_dir as '/path_to_dir/exp_dir';
18+
sql> grant read,write on directory new_imp_dir to system;
19+
```
20+
* Check the number and the status of schema objects
21+
```
22+
sql> select object_type,status,count(*) from user_objects group by object_type,status;
23+
```
24+
* Export the schema (user) you wish.
25+
```
26+
$ expdp system/password directory=new_imp_dir dumpfile=name_of_dump_file.dmp logfile=name_of_log_file.log schemas=name_of_schema
27+
```
28+
* Delete the schema objects.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# How to check Oracle corruption
2+
3+
(Tip given from MOS - myoracle support)
4+
5+
6+
Please check with RMAN if there are datablock corruptions :
7+
8+
```
9+
% rman target /
10+
RMAN> run {
11+
allocate channel d1 type disk;
12+
allocate channel d2 type disk;
13+
backup check logical validate filesperset 10 database;
14+
}
15+
```
16+
17+
RMAN is populating the view V$DATABASE_BLOCK_CORRUPTION with the above commands, if corrupted blocks are found
18+
19+
Use `sqlplus` and connect as `sysdba` user `sqlplus "/ as sysdba"` and run the following queries
20+
```sql
21+
SQL> select * from v$database_block_corruption ;
22+
23+
SQL> SELECT e.owner, e.segment_type, e.segment_name, e.partition_name, c.file#
24+
, greatest(e.block_id, c.block#) corr_start_block#
25+
, least(e.block_id+e.blocks-1, c.block#+c.blocks-1) corr_end_block#
26+
, least(e.block_id+e.blocks-1, c.block#+c.blocks-1)
27+
- greatest(e.block_id, c.block#) + 1 blocks_corrupted
28+
, null description
29+
FROM dba_extents e, v$database_block_corruption c
30+
WHERE e.file_id = c.file#
31+
AND e.block_id <= c.block# + c.blocks - 1
32+
AND e.block_id + e.blocks - 1 >= c.block#
33+
UNION
34+
SELECT s.owner, s.segment_type, s.segment_name, s.partition_name, c.file#
35+
, header_block corr_start_block#
36+
, header_block corr_end_block#
37+
, 1 blocks_corrupted
38+
, 'Segment Header' description
39+
FROM dba_segments s, v$database_block_corruption c
40+
WHERE s.header_file = c.file#
41+
AND s.header_block between c.block# and c.block# + c.blocks - 1
42+
UNION
43+
SELECT null owner, null segment_type, null segment_name, null partition_name, c.file#
44+
, greatest(f.block_id, c.block#) corr_start_block#
45+
, least(f.block_id+f.blocks-1, c.block#+c.blocks-1) corr_end_block#
46+
, least(f.block_id+f.blocks-1, c.block#+c.blocks-1)
47+
- greatest(f.block_id, c.block#) + 1 blocks_corrupted
48+
, 'Free Block' description
49+
FROM dba_free_space f, v$database_block_corruption c
50+
WHERE f.file_id = c.file#
51+
AND f.block_id <= c.block# + c.blocks - 1
52+
AND f.block_id + f.blocks - 1 >= c.block#
53+
order by file#, corr_start_block#;
54+
```
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to remove a RAC installation
2+
3+
<code>
4+
#rm -rf /etc/oracle
5+
#umount -f /u01
6+
#cat /etc/fstab
7+
#fdisk -l
8+
#mkfs.ext3 -L /u01 /dev/sdb1
9+
#mount -a
10+
#ls -la /u01
11+
#ls -la /etc
12+
#rm -rf /tmp/.oracle /usr/tmp/.oracle
13+
#vi /etc/inittab
14+
#rm -rf /etc/init.d/init.*
15+
#ps -aef|grep ora
16+
#rm /etc/oraInst.loc
17+
#cat /etc/sysconfig/rawdevices
18+
#dd if=/dev/zero of=/dev/sdd1
19+
#dd if=/dev/zero of=/dev/sde1
20+
#reboot
21+
</code>
22+
23+
<code>
24+
mkdir -p /u01/crs/oracle/product/10.2.0/crs
25+
mkdir -p /u01/app/oracle/product/10.2.0/db_1
26+
mkdir -p /u01/oradata
27+
chown -R oracle.oinstall /u01
28+
</code>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Install Oracle n CentOS Linux
2+
3+
## Pre-installation Tasks =====
4+
In order to install Oracle you need to meet some minimum hardware requirements and prepare the linux kernel a bit (by creating users and groups).
5+
6+
## Hardware Requirements
7+
In order to install Oracle Database 10gR2 on CentOS, your system needs to have the following requirements:
8+
9+
* 512 MB of RAM
10+
* 1 GB swap space (or twice the size of RAM)
11+
* 400 MB of disk space in the /tmp directory
12+
* 1.7 GB, at least, of disk space for the Oracle software. If you want the Sample Schema Database you need at least 2.1G of disk space.
13+
14+
## Configuring Linux
15+
You need to configure the system and create some groups and the oracle user. In order to create the groups you need to:
16+
17+
* Open a terminal and login as root
18+
* Create at least the dba and oinstall group. Other groups that can be created are the oper, asmdba, asmoper, dbsnmp
19+
```
20+
# groupadd oinstall
21+
# groupadd dba
22+
```
23+
* Create the OS user: **oracle**
24+
```
25+
# useradd -g oinstall -G dba oracle
26+
```
27+
* Enter a password for the oracle user you just created
28+
```
29+
# passwd oracle
30+
```
31+
* Change the process and file limits for oracle user by adding the following lines to /etc/security/limits.conf
32+
```
33+
oracle soft nproc 2047
34+
oracle hard nproc 16384
35+
oracle soft nofile 1024
36+
oracle soft nofile 65535
37+
```
38+
* Add the following lines to /etc/pam.d/login
39+
```
40+
session required /lib/security/pam_limits.so
41+
session required pam_limits.so
42+
```
43+
* Change the user limits for Oracle user by adding the following lines to /etc/profile
44+
```
45+
if [ $USER = "oracle" ]; then
46+
if [ $SHELL = "/bin/ksh" ]; then
47+
ulimit -p 16384
48+
else
49+
ulimit -u 16384
50+
fi
51+
fi
52+
```
53+
* Create the directories needed for the installation and change file ownerships to oracle user
54+
```
55+
# mkdir -p /u01/app/oracle
56+
# chown -R oracle:oinstall /u01/app
57+
# chmod -R 775 /u01/app
58+
```
59+
* Set the kernel parameters. Open the **/etc/sysctl.conf** file and **add** lines similar to the following values. These are the minimum values required by oracle, which means that if you have set up already those parameters higher than the values below, you need to skip that step and the one that follows.
60+
```
61+
kernel.sem = 250 32000 100 128
62+
kernel.shmall = 2097152
63+
kernel.shmmax = 2147483648
64+
kernel.shmmni = 4096
65+
fs.file-max = 65536
66+
net.core.rmem_default = 262144
67+
net.core.rmem_max = 262144
68+
net.core.wmem_default = 262144
69+
net.core.wmem_max = 262144
70+
net.ipv4.ip_local_port_range = 1024 65000
71+
```
72+
* In order for the changes in sysctl to take effect, you need to reboot either the system or to run:
73+
```
74+
# sysctl -p
75+
```
76+
77+
## Installing Oracle Database 10.2.1.0
78+
* As root run the following command:
79+
```
80+
# xhost +
81+
```
82+
* As Oracle user, go to the directory that you have downloaded the oracle software and run the installer.
83+
```
84+
$ ./runInstaller
85+
```

0 commit comments

Comments
 (0)