Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. # Instalar a biblioteca
  2. sudo apt-get install libaio1
  3.  
  4. # Criar a pasta
  5. sudo mkdir /opt/oracle
  6.  
  7. # Extrair para /opt/oracle
  8. instantclient-basic-linux.x64-18.5.0.0.0dbru.zip
  9. instantclient-sdk-linux.x64-18.5.0.0.0dbru.zip
  10.  
  11. # Criar o link simbolico da lib
  12. cd /opt/oracle/instantclient_18_5
  13. ln -s libclntsh.so.18.1 libclntsh.so
  14.  
  15. # Exporta as variaveis abaixo:
  16. export LD_LIBRARY_PATH=/opt/oracle/instantclient_18_5:$LD_LIBRARY_PATH
  17. export PATH=/opt/oracle/instantclient_18_5:$PATH
  18.  
  19. # Criando o projeto no Rails
  20. rails new projeto -d oracle
  21.  
  22. # Adiciona no Gemfile
  23. gem 'activerecord-oracle_enhanced-adapter'
  24. gem 'ruby-oci8'
  25.  
  26. # Instalando as gems
  27. bundle install
  28.  
  29. # colocar no config/boot.rb
  30. ENV['LD_LIBRARY_PATH'] ||= '/opt/oracle/instantclient_18_5'
  31. ENV['NLS_LANG'] = 'BRAZILIAN PORTUGUESE_BRAZIL.AL32UTF8'
  32.  
  33.  
  34. # Criar um arquivo config/oracle.rb e inserir o código
  35. ActiveSupport.on_load(:active_record) do
  36. ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
  37. # true and false will be stored as 'Y' and 'N'
  38. self.emulate_booleans_from_strings = true
  39.  
  40. # start primary key sequences from 1 (and not 10000) and take just one next value in each session
  41. self.default_sequence_start_value = "1 NOCACHE INCREMENT BY 1"
  42.  
  43. # Use old visitor for Oracle 12c database
  44. self.use_old_oracle_visitor = false
  45.  
  46. # other settings ...
  47. # ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.default_tablespaces =
  48. # {:clob => 'TSLOBS', :blob => 'TSLOBS', :index => 'TSINDEXES', :table => 'TSTABLES'}
  49. end
  50. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement