Feature #2272

Redmine on Oracle Database - Windows Installation

Added by Rodrigo Mesquita almost 13 years ago. Updated about 3 years ago.

Status:ClosedStart date:2008-12-03
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:DatabaseEstimated time:1.00 hour
Target version:-
Resolution:Fixed

Description

Hi folks!

This time i won't bother you with another problem to make Redmine compatible with Oracle.
I finally find a Oracle Adapter that fits with my environment.

What i've got:

  ruby186-26
  redmine-0.7.3
  ruby-oci8-1.0.3-mswin32
  activerecord-oracle_enhanced-adapter 1.1.8
  Oracle Database XE
  Windows XP Professional SP3

The steps i ran were:

1 - Installing Ruby (http://rubyforge.org/frs/download.php/29263/ruby186-26.exe) and put it on Windows PATH
2 - Unzipped Redmine (http://rubyforge.org/frs/download.php/39478/redmine-0.7.3.zip)
3 - I did some changes on \db\migrate\001_setup.rb as:

    create_table "projects", :force => true do |t|
      t.column "name", :string, :limit => 30, :default => "", :null => false
      t.column "description", :text, :default => nil, :null => true
      t.column "homepage", :string, :limit => 60, :default => "" 
      t.column "is_public", :boolean, :default => true, :null => false
      t.column "parent_id", :integer
      t.column "projects_count", :integer, :default => 0
      t.column "created_on", :timestamp
      t.column "updated_on", :timestamp
    end

and

   create_table "users", :force => true do |t|
      t.column "login", :string, :limit => 30, :default => "", :null => true
      t.column "hashed_password", :string, :limit => 40, :default => "", :null => true
      t.column "firstname", :string, :limit => 30, :default => "", :null => true
      t.column "lastname", :string, :limit => 30, :default => "", :null => false
      t.column "mail", :string, :limit => 60, :default => "", :null => true
      t.column "mail_notification", :boolean, :default => true, :null => false
      t.column "admin", :boolean, :default => false, :null => false
      t.column "status", :integer, :default => 1, :null => false
      t.column "last_login_on", :datetime
      t.column "language", :string, :limit => 2, :default => "" 
      t.column "auth_source_id", :integer
      t.column "created_on", :timestamp
      t.column "updated_on", :timestamp
    end

4 - Other small changes on \db\migrate\091_change_changesets_revision_to_string.rb

  class ChangeChangesetsRevisionToString < ActiveRecord::Migration
    def self.up
      change_column :changesets, :revision, :string
    end

    def self.down
      change_column :changesets, :revision, :integer
    end
  end

5 - Deleted the file \db\migrate\087_change_projects_description_to_text.rb
6 - Altered the \config\database.yml as follows:

production:
  adapter: oracle_enhanced
  host: <host>:1521:XE
  username: username
  password: pass

7 - Configured the \config\environment.rb to work with my SMTP address.
8 - Created on folder \config a sub-folder named initializers and put the file oracle_enhanced.rb with this:

ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.emulate_dates_by_column_name = true

ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.instance_eval do
  self.string_to_date_format = "%d/%m/%Y" 
  self.string_to_time_format = "%d/%m/%Y %H:%M:%S" 
end

9 - Downloaded the oci8 (http://rubyforge.org/frs/download.php/41043/ruby-oci8-1.0.3-mswin32.rb) and installed as:

c:\ruby> ruby ruby-oci8-1.0.3-mswin32.rb

10 - Install the oracle_enhanced (http://rubyforge.org/frs/download.php/44889/activerecord-oracle_enhanced-adapter-1.1.8.gem) as follows:

c:\ruby> gem install activerecord-oracle_enhanced-adapter

11 - Create a user on OracleDB with DBA privilegies.
12 - Execute this command: c:\redmine> rake db:migrate RAILS_ENV=production
13 - Execute this command: c:\redmine> ruby script/server -e production
14 - Go to browser and: http://localhost:3000/

Congratulations!

You finished it!

Considerations:

  001 - I can't load default data. An error occurred on inserting the collumn description due its size. 
  002 - The issues started at number 10000.

All other features are working fine. These considerations can be easily fixed with a minuncious analisys of adapter_enhanced. (I'm very occupied and can't see this for now - if someone could fix i apreciate it)

Hope i help the users who needs to use Redmine with Oracle.
I invite these people to test and validate the fix in this thread.

Cheers.

P.S: Sorry for the poor English.

Installing_Redmine_Oracle.pdf (179 KB) Rodrigo Mesquita, 2009-06-07 15:13


Related issues

Related to Redmine - Feature #944: Oracle Support in Redmine Closed 2008-03-28

History

#1 Updated by Rodrigo Mesquita almost 13 years ago

I've not mentioned it on the text above...

But the purpose of this topic is to provide the necessary information to include a How-to on redmine.org to those people who needs to use Redmine on Oracle.

Thanks

#2 Updated by Rodrigo Mesquita almost 13 years ago

  • Status changed from New to Resolved
  • % Done changed from 90 to 100

To start the number of issue on 1, alter the file C:\ruby\lib\ruby\gems\1.8\gems\activerecord-oracle_enhanced-adapter-1.1.8\lib\active_record\connection_adapters\oracle_enhanced_adapter.rb:

        def create_table(name, options = {}, &block) #:nodoc:
          create_sequence = options[:id] != false
          if create_sequence
            super(name, options, &block)
          else
            super(name, options) do |t|
              class <<t
                attr_accessor :create_sequence
                def primary_key(*args)
                  self.create_sequence = true
                  super(*args)
                end
              end
              result = block.call(t)
              create_sequence = t.create_sequence
            end
          end
          seq_name = options[:sequence_name] || "#{name}_seq" 
          execute "CREATE SEQUENCE #{seq_name} START WITH 1" if create_sequence #This line alter the value 10000 to 1
        end

Despite the problem on insert...

Alter the db\migrate\001_start.rb

    create_table "enumerations", :force => true do |t|
      t.column "opt", :string, :limit => 4, :default => "", :null => false
      t.column "name", :string, :limit => 40, :default => "", :null => false #Change limit of 30 to 40
    end

#3 Updated by Rodrigo Mesquita over 12 years ago

Hi folks!

I did some modifications on the above configuration, because i updated the version of redmine from 0.7.3 to 0.8.4 (i also tested on 0.8.0 RC1).

Worked fine with this environment:

  ruby186-26
  redmine-0.8.4
  ruby-oci8-1.0.3-mswin32
  activerecord-oracle_enhanced-adapter 1.1.8
  Oracle Database XE
  Windows XP Professional SP3

Until now, no problem on using it. From 0.8.0 to 0.8.4 i noticed a great raise of performance, making it comparable to MySQL databases... Congratulations!

Sorry for the language of the document attached. Next post i'll send in English language.

I also ask you admins to definetly make this software Oracle's compatible.

Thanks.

#4 Updated by Daniel Felix about 9 years ago

In my opinion, this ticket could be closed, doesn't it?

#5 Updated by Go MAEDA about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF