Re: [Bacula-users] moving from UTF-8 to SQL_ASCII -- SOLVED
2009-06-15 13:18:40
On 6/13/09 2:42 PM, Dan Langille wrote:
> David Newman wrote:
>> bacula-server-3.0.0, postgresql-server-8.2.13
>
>> Looking for guidance on moving a database from UTF-8 to SQL_ASCII.
>
>> I've been getting a bunch of warnings like this since moving to bacula 3.x:
>
>> bacula-dir JobId 0: Warning: Encoding error for database "bacula".
>> Wanted SQL_ASCII, got UTF8
>
>> I am apparently using UTF-8:
>
>> nye# su - pgsql -c 'psql -l | grep bacula'
>> bacula | bacula | UTF8
>
>> Dan Langille's message here suggested a fix:
>
>> http://www.mail-archive.com/bacula-devel AT lists.sourceforge DOT
>> net/msg02632.html
>
>> But these instructions produced a database-not-found error:
>
>> nye# sudo su - pgsql -c 'pg_dump /usr/home/bacula/baculaold >
>> /tmp/bacula.sql'
>> pg_dump: [archiver (db)] connection to database
>> "/usr/home/bacula/baculaold" failed: FATAL: database
>> "/usr/home/bacula/baculaold" does not exist
>
>> This is odd, since that file does exist and is world-readable:
>
>> nye# ls -l /usr/home/bacula/baculaold
>> total 290
>> -rw-r--r-- 1 bacula bacula 140976 Oct 25 2007 baculaold
>
> That is most likely not a database. It is highly unlikely for
> PostgreSQL to be storing data there.
>
> I suspect the problem starts with the pg_dump. I think what you want to
> do is:
>
> pg_dump bacula > bacula.sql
>
> This dump the bacula database and store it in a file, bacula.sql.
>
> PostgreSQL database names do not usually contain paths. You can view
> your PostgreSQL databases with this command: psql -l
Dan noted in his earlier message that his fix was untested. It needed a
couple of tweaks. Here is the sequence that worked for me (on FreeBSD
7.2-RELEASE):
(as root)
<bacula-dir stop command>
cd </location/of/current/bacula/database> # /home/bacula in my case
psql postgres # start postgresql cli session
alter database bacula rename to baculaold;
\q
# previous line ends postgresql cli session
pg_dump baculaold > bacula.sql
createdb -E SQL_ASCII -O bacula bacula # note 2nd 'bacula' for dbname
psql bacula < bacula.sql
<bacula-dir start command>
WARNING: This only works for translating databases from UTF8 to ASCII
format. It does not help if you are backing up filenames containing
UTF8-encoded characters.
If I understand Dan's post above on the bacula-devel list, Bacula
apparently has problems with UTF8 encoding and will silently omit
filenames with UTF8 characters. Bacula 3.x and this fix for existing
UTF8-format databases at least get bacula to report correctly on all the
ASCII-encoded filenames it handles. It does not address the underlying
issue of handling filenames with UTF8-encoded characters.
dn
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
|
|
|