Each student is provided with an empty pre-created database located
under a special directory:
/it/kurs/db1/users/(user_name)
where (user_name) is replaced by your own user name at the Solaris servers.
Please be aware that this directory is allocated for you only for the course and after the last deadline for the labs it will be no longer available to you. In case you need to use it for an extended period you must turn to your lab assistant.
1) Change your current directory to:
/it/kurs/db1/users/(user_name)
2) Start Mimer by the command:
bsql -s
The initial username and password for your personal database are:
Username: sysadm
Password: foo
You can change your password if you want (see Mimer SQL
manuals).
3) Load the scripts that create the Jonson Brothers database schema
and populate the schema with data by issuing the following commands
at the SQL> prompt:
SQL> read all input from '../MASTER/company_schema.sql';
SQL> read all input from '../MASTER/company_data.sql';
Now you are ready to work on assignments 2 and 3.
To start Mimer, change to your course directory:
/it/kurs/db1/users/(user_name)
and execute:
bsql -s
Mimer installation on the SUN/Solaris servers has command line interface. There are two ways to enter and execute SQL commands. Either you can type directly at the console OR type them in a separate file and then load the file. The first one is useful for experimentation, whilst the latter is the preferred way of work because that allows you to edit the commands more conveniently in a text editor and save your work.
To read SQL commands from a file you have to use the 'READ INPUT' command:
SQL> read all input from '(sql_file_name)';
Here (sql_file_name) is either a file in your current directory or the
full path name of a file with SQL commands.
Be aware that when you read more than once an SQL file that contains
DDL statements, you first have to drop (in the correct order) all the
database objects created in the file to avoid errors.
You can see how this is done in the schema definition file for the
Jonson Brothers database:
/it/kurs/db1/users/MASTER/company_schema.sql
You can create runnable files with SQL commands in which all other
text is entered as SQL comments (prefixed with '--'). To generate your report file you have to log the execution of the SQL command file. Logging can be set by the following lines at the beginning
of your SQL command file:
SET OUTPUT ON;
SET ECHO ON;
SET PAGELENGTH 0;
SET INPUT, OUTPUT LOG ON;
LOG INPUT, OUTPUT ON 'dbt-(lab_number)-(user_name).log';
In particular for Assignment 3 (SQL) you are required to use as a starting point for the SQL command file the template file:
/it/kurs/db1/users/[username]/dbt-3-template.sql
Copy this file to your work directory and rename it to whatever you like. Fill in the answers to the questions below the corresponding numbers, run the file when you are ready and print the resulting .log file. Please read the additional comments in the template file. Be aware that output filename will delete previous text from the file filename!
An example file with framework for user abcd1234 handing in Assignment 3 looks like this dbt-3-abcd1234.log.
You can always start from an empty database by deleting all *.dbf files in your working directory, copying all files from /it/kurs/db1/users/MASTER into your working directory and repeating steps 1-3 under section "How to create.." above.