Previous | Table of Contents | Next

Page 43

Database User

Every database connection is established on behalf of a database user. The terms table owner, Oracle user, and Oracle account are used interchangeably. A table owner is the database user that owns a table. A table owner is always an Oracle user, but an Oracle user may or may not own any tables of his or her own. An example should help explain this concept.

Let's look at the sample database. An Oracle account named FLUGLE owns all the tables for the college information system. Sally Jensen is the biology department administrator and has an Oracle account named JENSENS. However, even though Sally Jensen has access to all the tables owned by the FLUGLE account, she owns no tables of her own.

Every table that exists in an Oracle database must have an owner. A sensible approach is to create an owner that corresponds to the organization rather than to any individual in the organization. If you think about it, an organization's data—information that members of the organization create, modify, and use—doesn't belong to any one person. Also, given the dynamics of organizations, people come and go, but the organization remains.

In the sample application, instead of making an individual the owner of the Oracle tables, you are going to create a new user named FLUGLE and have that Oracle account own all of the tables in the application.

Connecting to an Oracle Database

Before you create a new Oracle user, you'll have to know how to connect to an Oracle database. Most Oracle tools provide a dialog window for establishing a connection to an Oracle database. The dialog window prompts you for three items:

If you're using Personal Oracle, you don't have to enter a database name. If you're trying to connect to an Oracle database on a server, you'll generally have to specify the database name.

Creating a New User

As a first step in setting up the sample database, you will create an Oracle user, FLUGLE, which will own all of the database objects in the application database. This section looks at two different ways to accomplish this. If you're using Personal Oracle for Windows 95, you'll see how to use the Navigator to create the new user. If you're using an Oracle server—either Workgroup Server or Universal Server—you'll see how the same task can be performed using Security Manager, a component of Oracle Enterprise Manager.

Page 44

Creating a New User with the Personal
Oracle Navigator

First, invoke the Navigator from the Personal Oracle for Windows 95 program group. To see the existing users in the local database, just double-click the User folder. A list of the existing users is displayed on the right side of the main window. To create the FLUGLE user, select the User folder and right-click New. The Navigator displays a window, prompting you for the username, the password, and the password confirmation. (See Figure 3.2.)

Figure 3.2.
Creating the FLUGLE
user with the
Navigator.

Click OK. The FLUGLE user is displayed in the list of existing users in the Local Database. (See Figure 3.3.)

Figure 3.3.
The FLUGLE user is
displayed in the list of
users in the Local
Database.

You'll want to assign an existing database role to the FLUGLE user—RESOURCE. This role enables the FLUGLE Oracle account to create new tables and other database objects. To assign this role, select the FLUGLE user and right-click Properties. A window with two tab folders will appear; select the Role/Privilege tab. Select the Roles radio button. Select the role named RESOURCE and click <. The role will be assigned to FLUGLE. (See Figure 3.4.)

Page 45

Figure 3.4.
Granting the
RESOURCE role to
the FLUGLE user.

Creating a New User with Security Manager

As an alternative to the Personal Oracle Navigator, this section leads you through the steps of creating a user with Security Manager, a component of Oracle Enterprise Manager. To initially use Security Manager, you need to connect to the Oracle database using an account with DBA privileges. For this purpose, use the SYSTEM account to initially connect to the Oracle database.

  1. To invoke Security Manager, select it from the Oracle Enterprise Manager program group. A dialog window displays, prompting you for username, password, and service. Enter SYSTEM, MANAGER, and FCIS into the respective fields as shown in Figure 3.5.

Figure 3.5.
Connecting to the
Oracle Server with
Security Manager.

NOTE
This example specifies the service or database as FCIS. You can create this database alias by using the SQL*Net Easy Configuration utility, as described in Day 1, "Exploring the World of Relational Databases." If you are using an Oracle server, please ask your DBA for the node and instance names that you should use when creating a new database alias with the SQL*Net Easy Configuration utility.

Page 46

  1. To create the new user, click the Users folder and either click the + button on the toolbar, or select User | Create from the menu.
  2. As shown in Figure 3.6, enter FLUGLE in the User field and FLUGLE in the Password and Confirm Password fields.
  3. If you're using Personal Oracle, enter USER_DATA for the Default Tablespace and TEMPORARY_DATA for the Temporary Tablespace.

Figure 3.6.
Adding the FLUGLE
user with Security
Manager.

Before you actually create the FLUGLE user, you'll grant the RESOURCE role to the FLUGLE user so that the user can create tables and other database objects.

  1. Click the Privileges folder.
  2. In the list of roles displayed at the bottom of the dialog window, select RESOURCE, and click the Add button (see Figure 3.7). The FLUGLE user will be created—you should see it displayed on the right side of the Security Manager window.
  3. To close Security Manager, select File | Exit from the menu.

Previous | Table of Contents | Next

Используются технологии uCoz