<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=OracleSetup</id>
	<title>OracleSetup - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=OracleSetup"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OracleSetup&amp;action=history"/>
	<updated>2026-08-22T00:02:30Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OracleSetup&amp;diff=2515&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OracleSetup&amp;diff=2515&amp;oldid=prev"/>
		<updated>2016-04-06T20:15:52Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== RT on Oracle ==&lt;br /&gt;
&lt;br /&gt;
RT 3.8.2 and newer are much easier to install on Oracle. See README.Oracle in the distribution for the main installation. In particular, the --with-db-database option should be set to a known SID in your local tns listener config.&lt;br /&gt;
&lt;br /&gt;
== Connection problems and TWO_TASK environment variable ==&lt;br /&gt;
&lt;br /&gt;
Since RT 3.8.2 you don&amp;#039;t need to set TWO_TASK or other environment variables.&lt;br /&gt;
&lt;br /&gt;
However, if you have connection problems, you should make sure that Oracle is available from the required place via DBI, using a command like;&lt;br /&gt;
&lt;br /&gt;
 TWO_TASK=FOO perl -MDBI -le &amp;#039;DBI-&amp;amp;gt;connect(&amp;quot;DBI:Oracle:&amp;quot;, &amp;quot;rt3&amp;quot;, &amp;quot;rt3&amp;quot;)&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
You will need to make sure that the TWO_TASK environment variable is set appropriately for RT. If you are running RT as an application server (eg, [[FastCGI]] mode), then in the script that you start RT with, export that environment variable as normal. Otherwise, if you are running it with mod_perl, then you can either set it in your httpd.conf;&lt;br /&gt;
&lt;br /&gt;
 PerlSetEnv TWO_TASK  FOO&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Or in etc/[[RT SiteConfig|RT_SiteConfig]].pm in your RT installation tree;&lt;br /&gt;
&lt;br /&gt;
 $ENV{TWO_TASK}=&amp;quot;LIVE&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
If you see this problem on RT 3.8.2 or newer then please report your case with relevant details using [[MailingLists]].&lt;br /&gt;
&lt;br /&gt;
== Encoding problem with mod_perl2 ==&lt;br /&gt;
&lt;br /&gt;
If there is problem with accents on the web pages for text from the database, it might be needed to add the following environnement variables to apache startup script:&lt;br /&gt;
&lt;br /&gt;
 export NLS_LANG=&amp;quot;AMERICAN_AMERICA.AL32UTF8&amp;quot;&lt;br /&gt;
 export NLS_NCHAR=&amp;quot;AL32UTF8&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(for [[RedHat]] El5, it can be added to /etc/sysconfig/httpd which is sourced by /etc/init.d/httpd) (remark: that didn&amp;#039;t work for me, it does when set to AMERICAN_AMERICA.WE8MSWIN1252 which is also my database charset!, see also: [http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang faq.htm http://www.oracle.com/technology/tech/globalization/htdocs/nls_lang%20faq.htm])&lt;br /&gt;
&lt;br /&gt;
If you see this problem on RT 3.8.2 or newer then please report your case with relevant details using [[MailingLists]].&lt;br /&gt;
&lt;br /&gt;
== Debugging the schema deployment ==&lt;br /&gt;
&lt;br /&gt;
If you have problems deploying the schema, you can run the deployment script manually;&lt;br /&gt;
&lt;br /&gt;
 TWO_TASK=FOO perl sbin/rt-setup-database --dba=rt3 --dba-password=rt3 --action init&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Since RT 3.8.3 you can drop DB by dropping RT&amp;#039;s user with all his object in the database:&lt;br /&gt;
&lt;br /&gt;
 DROP USER rt_user CASCADE&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
For older versions of RT it can be trickier cuz unlike the other databases, dropping the tables to start again is a more complex operation than issuing &amp;quot;DROP DATABASE FOO&amp;quot;. You need to individually drop all components. In the RT contrib directory (http://download.bestpractical.com/pub/rt/contrib/3.0/), there is a script called nuke-schema.pl which will do this for you.&lt;br /&gt;
&lt;br /&gt;
== Debugging Operational Problems ==&lt;br /&gt;
&lt;br /&gt;
Oracle is designed to be a highly concurrent database, and as such AUTO_INCREMENT ID columns are shunned in favour of these things called &amp;quot;Sequences&amp;quot;, which are ID generators that can serve multiple connections independantly without all that expensive IPC locking.&lt;br /&gt;
&lt;br /&gt;
If you get insert problems when you stick tickets into a database (for instance), it is possible that your sequences are out of whack. In this case, run the fix-sequences.pl script in the contrib directory. This will have the side-effect of incrementing all of the sequences by 1, due to the way that Oracle sequences work.&lt;br /&gt;
&lt;br /&gt;
To see the Oracle errors in the error log, it may be necessary to turn on DBI debugging, by setting DBI_TRACE=1 in the environment.&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
* orafaq.com - One of the best places on the net to find Oracle info!&lt;br /&gt;
&lt;br /&gt;
== Gap in Tickets Numbering ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;ve found in my RT setup (RT 3.4.5 &amp;amp;amp; Fast CGI &amp;amp;amp; Oracle 10g) that for some unknown reason there is sometimes a gap between the number of two tickets. If I restart the apache server, then there is a gap of 20 between the old ticket and the new one.&lt;br /&gt;
&lt;br /&gt;
On my oracle server, I have changed all the sequences by replacing the &amp;#039;CACHE 20&amp;#039; by &amp;#039;NOCACHE&amp;#039; and now it is ok. Don&amp;#039;t know why I have this, I have no problems with Oracle Sequences in my other softs.&lt;br /&gt;
&lt;br /&gt;
Bruno K.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;About Oracle Sequence Gaps&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Oracle sequences retrieve numbers into memory on demand. If you are caching sequence numbers (e.g. cache 20), Oracle reads twenty numbers into memory at a time and hands them out on demand. When the cache is empty and another number is needed, another cache read is run.&lt;br /&gt;
&lt;br /&gt;
Oracle never reuses sequence numbers (unless you wrap all the way around the sequence). Once requested, that number is gone. If a user gets a number and rolls back their transaction, the next sequence get reads a later number. Also, if you have numbers cached in memory and the instance stops (say, to take a backup), all cached numbers are also gone.&lt;br /&gt;
&lt;br /&gt;
NOCACHE will reduce the chance of gaps, but not eliminate it.&lt;br /&gt;
&lt;br /&gt;
Pinning the sequences into the SGA will also reduce this problem&lt;br /&gt;
&lt;br /&gt;
- doug&lt;br /&gt;
&lt;br /&gt;
== Script to make sequences NOCACHE ==&lt;br /&gt;
&lt;br /&gt;
Save the block below to a file ( [[AlterSequences]].sql ) then execute it. It will select all the user Sequences and create a new script in a temp file with the syntax to make the sequences NOCACHE, then execute that temp script.&lt;br /&gt;
&lt;br /&gt;
--- Cut Here [[AlterSequences]].sql ---&lt;br /&gt;
&lt;br /&gt;
 SET TERM      OFF&lt;br /&gt;
 -- TERM = ON will display on terminal screen (OFF = show in LOG only)&lt;br /&gt;
 &lt;br /&gt;
 SET ECHO      OFF&lt;br /&gt;
 -- ECHO = ON will Display the command on screen (+ spool)&lt;br /&gt;
 -- ECHO = OFF will Display the command on screen but not in spool files.&lt;br /&gt;
 -- Interactive commands are always echoed to screen/spool.&lt;br /&gt;
 &lt;br /&gt;
 SET TRIMOUT   ON&lt;br /&gt;
 -- TRIMOUT = ON will remove trailing spaces from output&lt;br /&gt;
 &lt;br /&gt;
 SET TRIMSPOOL ON&lt;br /&gt;
 -- TRIMSPOOL = ON will remove trailing spaces from spooled output&lt;br /&gt;
 &lt;br /&gt;
 SET HEADING   OFF&lt;br /&gt;
 -- HEADING = OFF will hide column headings&lt;br /&gt;
 &lt;br /&gt;
 SET FEEDBACK  OFF&lt;br /&gt;
 -- FEEDBACK = ON will count rows returned&lt;br /&gt;
 &lt;br /&gt;
 SET PAUSE     OFF&lt;br /&gt;
 -- PAUSE = ON .. press return at end of each page&lt;br /&gt;
 &lt;br /&gt;
 SET PAGESIZE  0&lt;br /&gt;
 -- PAGESIZE = height 54 is 11 inches (0 will supress all headings and page brks)&lt;br /&gt;
 &lt;br /&gt;
 SET LINESIZE  132&lt;br /&gt;
 -- LINESIZE = width of page (80 is typical)&lt;br /&gt;
 &lt;br /&gt;
 SET VERIFY    OFF&lt;br /&gt;
 -- VERIFY = ON will show before and after substitution variables&lt;br /&gt;
 &lt;br /&gt;
 -- Start spooling to a log file&lt;br /&gt;
 SPOOL tempAlterSeq.sql&lt;br /&gt;
 &lt;br /&gt;
 select &amp;#039;ALTER SEQUENCE &amp;#039; || sequence_name || &amp;#039; NOCACHE;&amp;#039;&lt;br /&gt;
   from user_sequences;&lt;br /&gt;
 &lt;br /&gt;
 SPOOL OFF&lt;br /&gt;
 @tempAlterSeq.sql&lt;br /&gt;
 EXIT&lt;br /&gt;
&lt;br /&gt;
--- End Cut ---&lt;br /&gt;
&lt;br /&gt;
How to run that script? If you are running Oracle XE on Ubuntu, the setup would be something like:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;sudo su oracle -&lt;br /&gt;
 . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh&lt;br /&gt;
 # consider adding that line to the oracle users ~/.bashrc file&lt;br /&gt;
 touch AlterSequences.sql&lt;br /&gt;
 nano AlterSequences.sql&lt;br /&gt;
 # Paste in the script from above&lt;br /&gt;
 # Save, Exit&lt;br /&gt;
 sqlplus rt @ AlterSequences.sql&lt;br /&gt;
 # Enter your RT password&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Done.&lt;br /&gt;
&lt;br /&gt;
Clean up temp[[AlterSeq]].sql after a successful run.&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>