Upload
michitoshi-yoshida
View
325
Download
0
Embed Size (px)
Citation preview
DBA Oracle Database
2016.09.12 - JPOUG in 15 minutes #1 Michitoshi Yoshida
(@miyosh0008)
• (@miyosh0008)
• Engineered Systems
Exadata, Exalogic, Exalytics, etc..
•
etc..
Oracle Database
DB
+ RAC + PDB
Oracle DB
1.
2.
3.
4.
•
Chef -
-
- Recipe Ruby
Puppet - 2005
- Chef
- Puppet Enterprise
•
Ansible - Python 2.4
- YAML
- 2015 RedHat
Itamae - Chef
- Chef Ruby
-
• Serverspec -
- RSpec Ruby
-
Testinfra - Serverspec Python
- pytest Python
- Serverspec
•
Infrataster - Serverspec RSpec
-
: WEB URL HTTP
200 etc..
- Serverspec
3.→ alter
ShellScript OK Ansible
#
: Hello,module! 15 Ansible Bash
4.
→ OS Serverspec
SQL
SQL
Infrataster
→
Infrataster-plugin-oracledb
•
•
-
- REDO
- SQL
Infrataster-plugin-oracledb• Infrataster Gem
gem bundler #
# m(_ _)m
# zip $ unzip /tmp/instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle/instantclient/$ unzip /tmp/instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle/instantclient/
# $ cd /opt/oracle/instantclient/instantclient_12_1$ ln -s libclntsh.so.12.1 libclntsh.so$ ln -s libocci.so.12.1 libocci.so$ echo "/opt/oracle/instantclient/instantclient_12_1" >/etc/ld.so.conf.d/oracle.conf
# .bash_profile export ORACLE_HOME=/opt/oracle/instantclient/instantclient_12_1export LD_LIBRARY_PATH=$ORACLE_HOME
Step1: Oracle Instant Client
Basic SDK
# $ mkdir oracle_test$ cd oracle_test
# Gemfile $ cat Gemfilesource 'https://rubygems.org'gem 'infrataster'gem ‘infrataster-plugin-oracledb'
# # : ruby bundler $ bundle install$ bundle show | grep infrataster * infrataster (0.3.2) * infrataster-plugin-oracledb (0.1.0) # ← OK
Step2: infrataster infrataster-plugin-oracledb
# spec$ cp -r $(bundle show infrataster-plugin-oracledb)/spec ./
# spec_helper.rb $ vi spec/spec_helper.rb
# spec_helper.rb... ...Infrataster::Server.define( :orcl, # ← ‘192.168.56.101', # ← oracledb: { user: 'system', password: 'oracle', service_name: 'orcl'},)... ...
Step3:
# oracledb_query_spec.rb $ vi spec/oracledb_query_spec.rb
# oracledb_query_spec.rb# coding: utf-8require 'spec_helper'
describe server(:orcl) do describe oracledb_query('select name,display_value from v$parameter') do # check db_block_size it "initialization parameter 'db_block_size' should equal 8192" do row = results.find { |r| r['NAME'] == 'db_block_size' } expect(row['DISPLAY_VALUE'].to_i).to eq 8192 end endend
Step4:
: db_block_size 8192
$ bundle exec rspec
Warning: NLS_LANG is not set. fallback to US7ASCII.Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 28464.
Finished in 0.06133 seconds (files took 0.4652 seconds to load)1 example, 0 failures
Randomized with seed 28464
Step5:
1 0
# .rspec $ cat .rspec--color--format documentation
$ export NLS_LANG=JAPANESE_JAPAN.AL32UTF8$ bundle exec rspec
... ...server 'orcl' oracledb_query 'select name,display_value from v$parameter' initialization parameter 'db_block_size' should equal 8192
Finished in 0.0545 seconds (files took 0.41626 seconds to load)1 example, 0 failures... ...
Step6:
RSpec