Kamis, 23 Juli 2020

Latihan-02

03. Install and Maintain Oracle Database

1. Setting oracle database menjadi archivelog

 - Periksa status archivelog current database  
   [oracle@oravbox ~]$ sqlplus / as sysdba

  SQL> archive log list
  Database log mode              No Archive Mode
  Automatic archival             Disabled
  Archive destination            USE_DB_RECOVERY_FILE_DEST
  Oldest online log sequence     5
  Current log sequence           7

 - Soal : Buat database sehingga menjadi archive mode spt ini :
  SQL> archive log list
  Database log mode           Archive Mode
  Automatic archival          Enabled
  Archive destination          /oracle/data/arch
  Oldest online log sequence    7
  Next log sequence to archive  9
  Current log sequence         9
  
 - Petunjuk umum :
   1.1. Buat direktori di OS untuk archiving yaitu : /oracle/data/arch
   1.2. set Archive destination ke  /oracle/data/arch  
   1.3. Shutdown database
   1.4. startup mount
   1.5. alter database archivelog;
   1.6. alter database open;

2. Install database postgreSQL versi 9.3.9 
   2.1. Source ada di /source/postgresql-9.3.9
        atau di folder share \\10.10.40.117\03. Install and Maintain Oracle Database
   2.2. Untuk tambah space Hapus folder bekas install database mysql dan postgres 9.4 ( kalau ada ) : 
        /usr/my.cnf,/usr/my-new.cnf,/usr/mysql-cluster.cnf, /usr/pgsql-9.4, /usr/local/pgsql-9.4,/usr/pgsql
   2.3. Step install ada di /source/postgresql-9.3.9/INSTALL
      Step umum untuk install S/W dari source code (bukan rpm atau bin) adalah :
      - masuk ke direktori source code ( /source/postgres-9.3.9 )
      - ./congigure
        Periksa outputnya dan perbaiki bila ada error
      - make
        Periksa outputnya dan perbaiki bila ada error
      - make install
        Periksa outputnya dan perbaiki bila ada error
      - Bila sukses, hasil install ada di /usr/local/pgsql
      
      Langkah berikutnya buat initial database 
    - buat user postgres bila belum ada
    - buat direktori untuk tempat database di /usr/local/pgsql/data
      - ganti owner direktori  /usr/local/pgsql ke postgres
      - su - postgres
      - tambahkan direktori /usr/local/pgsql/bin ke variable $PATH atau di .bash_profile
      - run program initdb dengan opsi -D /usr/local/pgsql/data
      - start database 
      - buat database test
        createdb test
      - test login ke postgres dan database test
        psql test

3. Edit pga_hba.conf agar bisa di konek 
      3.1 hanya dari ip 10.10.x.y dari 10.1.x.y tidak bisa
      2.2 hanya dari ip 10.1.x.y dari 10.10.x.y tidak bisa
      3.3 bisa dikonek dari ip 10.10.x.y dan 10.1.x.y 
          untuk 3.3 Usahakan update hanya satu baris di pg_hba.conf spt berikut :
          host    all             all             10.x.y.z/nn          md5

4. Buat user / role sbb :
   nama user : usr01
   password  : pwdusr01

5. Buat tablespace
   dengan nama : ts01
   owner       : usr01
   lokasi tablespace : /postgres/data

6. Buat database sbb :   
   Nama database : db01
   owner : usr01
   tablespace : ts01

7. test login :
   [postgres@oravbox data]$ psql -U usr01 -d db01
   psql (9.3.9)
   Type "help" for help.

   db01=>