Edited at

Rails4 で Oracle を使い始める

More than 5 years have passed since last update.


- Rails 4.0.4

- ruby-oci8 (2.1.7)

- activerecord-oracle_enhanced-adapter (1.5.4)


- sqlplus system/oracle@ で接続できる


- https://github.com/usutani/blog_with_oracle_enhanced-adapter


alias g='git'

alias be='bundle exec'

rails _4.0.4_ new blog --skip-bundle

cd blog

vi Gemfile

gem 'ruby-oci8', '~> 2.1.0'

gem "activerecord-oracle_enhanced-adapter", "~> 1.5.0"

bundle install --path vendor/bundler

vi config/database.yml


adapter: oracle_enhanced
database: //
username: blog_development
password: oracle

$ be rake db:create

Please provide the SYSTEM password for your Oracle installation
> oracle

be rake db:migrate:status

be rake db:migrate

sqlplus blog_development/oracle@

SQL> select * from tab;

SQL> desc schema_migrations

rails g scaffold Post title body:text

be rake db:migrate

rails s



sqlplus system/oracle@

SQL> select username from all_users;

SQL> drop user USER cascade;