I really like the v12 innovation that the Sybase Central Wizards have an additional page to display the generated tool command line.

But for the "Create Database Wizard", I would like to get the according DBINIT command (in addition to or instead of the CREATE DATABASE statement).

The same goes for the reload.sql script created by the "Unload Wizard" (and the DBUNLOAD utility): The reload.sql contains the according CREATE DATABASE statement as comment. Here, I would like to get the DBINIT command, too.

Reasoning:

When migrating databases, the CREATE DATABASE statement is usually the only statement that has to be run against the utility_db or another database. When working on production servers, connecting to the utility_db or a SA demo database is not always available. (And it usually takes some time (at least for me) to find an appropriate dummy database just in order to run CREATE DATABASE...).

Here, a DBINIT command seems much easier to use.

It's not too hard to manually translate a CREATE DATABASE statement to the DBINIT syntax but in newer versions the number of options has significantly increased (say, just for the NCHAR stuff).


EDIT:

According to John's answer, DBINIT itself connects to the utility_db internally. Then my reasoning against CREATE DATABASE w.r.t. to the possible unavailability of the utility_db on production servers is pointless: Apparently, DBINIT would then fail there, too. - But I still think that DBINIT is easier to use. - Corrected: As DBINIT starts its own engine, restrictions of a production engine (e.g. the -su option) won't apply...

asked 15 Dec '10, 16:44

Volker%20Barth's gravatar image

Volker Barth
31.3k312458674
accept rate: 33%

edited 20 Dec '10, 21:19


dbinit just starts a new engine, connects to the utility_db on it and sends it a CREATE DATABASE statement.

It connects with the following connection string: UID=DBA;PWD=SQL;AUTOSTOP=yes;DBN=utility_db;ENG=dbinit_engine;START=dbeng12 -gp 4096 -c 10M;LINKS=SharedMemory;IGNORESQLCONNECT=YES

The -gp value should match the page size of the database.

-john.

permanent link

answered 17 Dec '10, 19:39

John%20Smirnios's gravatar image

John Smirnios
9.0k377114
accept rate: 39%

1

How does that knowledge make it easy to create a database initialization command for, say, inclusion in a Windows command file? Are you suggesting a dbisql command with a CREATE DATABASE statement? Does Sybase Central let you do that with a simple copy and paste?

(18 Dec '10, 12:00) Breck Carter

@John: IGNORESQLCONNECT - yet another undocumented connection parameter that was uncovered?

(18 Dec '10, 20:30) Volker Barth

@Breck: That are my questions, too:)

(18 Dec '10, 20:31) Volker Barth
1

Volker said connecting to a utility_db was not always available in a production environment and that's why he needed dbinit; however, connecting to a utility_db is exactly what dbinit does so it must be available.

I don't see any specific request for something to use in a command file but how about dbisql -c connection_string create database ...

For an install, you may have already implemented other means of connecting & executing SQL too.

(19 Dec '10, 13:02) John Smirnios
1

IGNORESQLCONNECT is completely unnecessary. If it does actually need to be ignored, dbinit should just have cleared it in its own environment rather than implementing an option in the connection string parsing. I can't vouch for everyone's historical choices :)

(19 Dec '10, 13:02) John Smirnios

@John: Ah, I just wasn't aware that DBINIT connects to the utility_db internally. Then, of course, my reasoning against CREATE DATABASE in the question is partly wrong - see my edits there.

(20 Dec '10, 09:27) Volker Barth
Comment Text Removed
1

I don't think dbinit would fail in that environment. I think you missed the fact that dbinit connects to an engine whose name is 'dbinit_engine'. There is nothing special about that name except that it is unlikely that an engine with that name will already be running. Effectively, dbinit just autostarts a new standalone server with the name 'dbinit_engine' and connects to the utility_db on it.

(20 Dec '10, 15:32) John Smirnios
More comments hidden
showing 5 of 7 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×414
×107
×8
×7

question asked: 15 Dec '10, 16:44

question was seen: 2,798 times

last updated: 20 Dec '10, 21:19