Database stuff

From Dw0rm's Wiki

Table of contents

Oracle configuration file

(TODO: check this :)
  • $ORACLE_BASE/admin/lof/pfile/initlof.ora

What is the Oracle listener?

Every time a client/server acting as client requests a session with a server the actual request comes into a listener. The listener identifies the target server and routes the request to that server. The listener is a separate process whose whole responsibility is to listen for incoming client connection requests and manage the traffic to the server.

"not exists" clause

  • select something where it does not exist somewhere else:
Here we are looking for all auctions without any bids:
(Note that the where clause needs to join table a and b correctly)
select a.* from auction a
where not exists (select * from bid b
where a.id = b.auction_id);

stop/start oracle database

  • easy way: (for 9i - in older versions sys instead of sysdba is used)
  sqlplus /nolog
  connect sysdba/<password> as sysdba
  shutdown immediate;  or  startup force; 

Adding users in MySql

The easiest way to add a user and give him privileges is by:
 First, use the mysql program to connect to the server as the MySQL root user:

shell> mysql --user=root mysql

If you have assigned a password to the root account, you also need to supply a --password or -p option for 
this mysql command and also for those later in this section.

After connecting to the server as root, you can add new accounts. The following statements use GRANT to 
set up four new accounts:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
    ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;