Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save asssis/d14f376f9edbc2df1430c38ae6feaff6 to your computer and use it in GitHub Desktop.
Save asssis/d14f376f9edbc2df1430c38ae6feaff6 to your computer and use it in GitHub Desktop.
Rails Oracle Client 18 Linux
# Instalar a biblioteca
sudo apt-get install libaio1
# Criar a pasta
sudo mkdir /opt/oracle
# Fazer donwload do basic e sdk client
https://drive.google.com/drive/folders/1Oa6nbLkSPLlFYLWKvehA79IzOeaYxErq
# unzip (arquivo)
# copiar os dois para /opt/oracle/
# Criar o link simbolico da lib
cd /opt/oracle/instantclient_19_6
ln -s libclntsh.so.18.1 libclntsh.so
# Exporta as variaveis abaixo:
echo 'export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_6:$LD_LIBRARY_PATH' >> ~/.bashrc
echo 'export PATH=/opt/oracle/instantclient_19_6:$PATH' >> ~/.bashrc
# Criando o projeto no Rails
rails new projeto -d oracle
# Adiciona no Gemfile
gem 'activerecord-oracle_enhanced-adapter'
gem 'ruby-oci8'
# Instalando as gems
bundle install
# colocar no config/boot.rb
ENV['LD_LIBRARY_PATH'] ||= '/opt/oracle/instantclient_18_5'
ENV['NLS_LANG'] = 'BRAZILIAN PORTUGUESE_BRAZIL.AL32UTF8'
# Criar um arquivo config/oracle.rb e inserir o código
ActiveSupport.on_load(:active_record) do
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
# true and false will be stored as 'Y' and 'N'
self.emulate_booleans_from_strings = true
# start primary key sequences from 1 (and not 10000) and take just one next value in each session
self.default_sequence_start_value = "1 NOCACHE INCREMENT BY 1"
# Use old visitor for Oracle 12c database
self.use_old_oracle_visitor = false
# other settings ...
# ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_tablespaces =
# {:clob => 'TSLOBS', :blob => 'TSLOBS', :index => 'TSINDEXES', :table => 'TSTABLES'}
end
end
#instalando o openjdk requisito
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
#instalar o sqldeveloper
.desktop /usr/share/applications/
sudo nano /usr/share/applications/sqldeveloper.desktop
GNU nano 4.8 /usr/share/applications/sqldeveloper.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=SQL Developer
GenericName=Oracle Development Environment
Comment=Proprietary environment for managing Oracle databases
Exec=sqldeveloper %F
Icon=/opt/sqldeveloper/icon.png
Terminal=false
Categories=Development;IDE;
StartupNotify=true
# criar icone
Version=1.0
Encoding=UTF-8
Name=SQL Developer
Type=Application
Terminal=false
Exec=sh /opt/sqldeveloper/sqldeveloper.sh
Icon[pt_BR]=/opt/sqldeveloper/icon.png
Name[pt_BR]=SQL Developer
Comment[pt_BR]=SQL Developer
Comment=SQL Developer
GenericName[pt_BR]=
Icon=/opt/sqldeveloper/icon.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment