Working with the Oracle SQL Developer 3.docx

Embed Size (px)

Citation preview

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    1/54

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    2/54

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    3/54

    3 . In the Connections navigator, right-click Connections and select New Connection .

    4 . The New / Select Database Connection dialog window opens. Enter the connection details as

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    4/54

    follows and click Test .

    Connection Name: System Username: system Password: < your_system_password>

    Hostname: SID:

    5 . If the status is success, click Save to save the connection, and then click Connect .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    5/54

    6 . The connection is saved and you see the connection in the Connections list.

    Accessing the DBA Navigator

    SQL Developer enables users with Database Administrator (DBA) privileges to view andedit certain information relevant to DBAs and, in some cases to perform certain DBAoperations.

    In order to perform DBA operations, you must use the DBA Navigator, which is similar to

    the Connections Navigator. If the DBA Navigator is not visible, perform the followingsteps to open and add a connection in the DBA Navigator.

    1 . Select View > DBA .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    6/54

    2 . A DBA Navigator opens. Click in the DBA window to create the System connection.

    3 . You should add only those connections for which the associated database user has DBA

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    7/54

    privileges. You can use the System connection because it has the DBA privileges.

    Select System for your Connection and click OK .

    4 . Expand the System connection in the DBA Navigator.

    Viewing Database Feature Usage

    Oracle SQL Developer makes it very easy to view database usage statistics and to managedatabase objects.

    In this topic, you view the number of detected database usages for certain database features.

    You generate reports on the detected usages.

    Perform the following steps to view detected database usages:

    1 . Expand the Database Configuration node and select View Database Feature Usage from thesub-menu.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    8/54

    2 . A window opens on the right where you can view the name of the database feature and thenumber of detected usages. Use the scroll bar to scroll through the list. Note that the column onthe right identifies the detected usages per database feature.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    9/54

    3 . You can save this information to a report. For example, you might want to create a report thatidentifies features where the usage is greater than zero.

    To generate the report, right-click and select Save Grid as Report .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    10/54

    4 . Enter the following details:

    Name: detected_usage greater than 0

    Description: Report on detected usage features that are greater then 0.Tooltip: Detected usage is greater than 0

    Set the Style to Table.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    11/54

    5 . To view all the features whose detected usage is more than 0, include and u1.detected_usages>0within the where clause for the subquery.

    6 . To view the report in the descending order of detected usage add sub1 order by 2 desc at the endand then click Apply . (Note that "sub1" is an alias to the inner/sub query. "order by 2 desc"identifies that you want to order by the second column listed in the SELECT clause for themain/outer query).

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    12/54

    7 . To view the report that you just saved, select View > Reports .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    13/54

    8 . Expand User Defined Reports and select the report detected_usage greater than 0 .

    9 . Select the Connection as System and click OK .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    14/54

    10 . The report displays the database features whose detected usage is greater than 0 in descendingorder.

    Editing Database Initialization Parameters

    Managing an Oracle instance includes configuring parameters that affect the basicoperation of the Oracle instance. These parameters are called initialization parameters.Database administrators can use initialization parameters to:

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    15/54

    optimize performance by adjusting memory structures set database-wide defaults set database limits

    With SQL Developer 3.0, you can view initialization parameters, examine their values and

    adjust some of the parameter values.

    1 . To view the initialization parameter values, click Initialization Parameters in the DBAnavigator window.

    The list of the initialization parameters and their values appear on the right.

    2 . The initialization parameters are listed alphabetically by default. You can scroll through the list tosee the parameter name, value, and data type, as well as whether it is modified, dynamic or classified as Basic.

    Note: Not all of the initialization parameters are editable through SQL Developer.

    Change the open_cursors parameter limit. The open_cursors parameter specifies the maximumnumber of open cursors a session can have at once. You can use this parameter to prevent a

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    16/54

    session from opening an excessive number of cursors. It is important to set the value of open_cursors high enough to prevent your application from running out of open cursors. Thenumber will vary from one application to another.

    Scroll through the Parameter list and find the open_cursors parameter.

    3 . Double click the Value field. An edit box appears.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    17/54

    4 . Enter the value 250. Click OK.

    5 . Note that the value of the open_cursors parameter is now set to 250.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    18/54

    Setting Audit Privileges

    In SQL Developer 3.0, the security settings have been enhanced to provide greater controlto different users. Using the Security node within the DBA Navigator, there are severaloptions related to database security management. For example, you can change the auditsettings and enable auditing. When you enable auditing, an audit trail is recorded. You havesome options on whether you want to include SYS user actions and the location for theaudit file.

    In this topic, you learn to turn on the audit for privileges and for objects.

    1 . You might want to track every time a privilege is granted. For example, you may want to track when the ALTER TABLESPACE or the CREATE DIRECTORY privilege is given out.

    For auditing a privilege, in the DBA Navigator, expand the Security node, right-click AuditSettings and select Edit Audited Privileges .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    19/54

    The Edit Audited Privileges dialog opens.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    20/54

    2 . To audit SYSTEM's usage of the GRANT statement, select User for the User or Proxy field.Select SYSTEM for the User or Proxy Name.

    Leave the Statement Execution Condition to the default of Success or Failure. This trackswhether a GRANT or REVOKE statement executed by SYSTEM is successful or not.

    Change the DML Audit Granularity field to Access.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    21/54

    3 . Select the privilege that you want to track for the SYSTEM user. For this example, choose theALTER TABLESPACE and the CREATE DIRECTORY privilege from the Available column

    and then click to move it to the Selected column.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    22/54

    4 . Click the SQL tab to view the SQL statement that is generated based on your selections.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    23/54

    5 . Click Apply .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    24/54

    6 . Click OK .

    7 . To view the changes you made, right-click Audit Settings and select Open .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    25/54

    8 . In the Configuration tab, note that the Audit File Directory is automatically filled in.

    9 . Click the Audited Privileges tab.

    Scroll to the bottom of the window to view the audit settings that you have added.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    26/54

    10.

    For auditing an object, in the DBA Navigator, expand the Security node, right-click AuditSettings and select Edit Audited Objects .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    27/54

    11.

    To audit changes to the HR EMPLOYEES table, select TABLE for the Object Type field.

    Select HR for the Schema field.

    Select EMPLOYEES for the Object Name field.

    Leave the Statement Execution Condition to the default of Success or Failure.Change the DML Audit Granularity field to Session.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    28/54

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    29/54

    Click to move your choices to the Selected column.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    30/54

    13. Click the SQL tab to view the SQL statement that is generated based on your selections.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    31/54

    Then click Apply.

    14.

    Click OK .

    15.

    To view the changes you made, right-click Audit Settings and select Open .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    32/54

    16.

    Click the Audited Objects tab.

    17.

    The Audit Settings on the HR EMPLOYEES table are displayed.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    33/54

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    34/54

    3 . Click the System Privileges tab.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    35/54

    4 . Select these system privileges: CHANGE NOTIFICATION, CREATE SEQUENCE, CREATE

    SESSION, CREATE SYNONYM, CREATE VIEW, UNLIMITED TABLESPACE.

    5 . Click the SQL tab to view the SQL statement generated by your choices.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    36/54

    Click Apply.

    6 . Click OK .

    7 . View the HRAMIN user in the DBA Navigator. Expand System > Security > Users >HRADMIN > Granted System Privileges.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    37/54

    8 . Now you will create a role.

    In the DBA Navigator, expand System > Security. Right-click Roles and select Create New.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    38/54

    9 . Select the Role Name as DEV_ROLE . Provide and confirm the password.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    39/54

    10.

    Click the System Privileges tab.

    11.

    Select these system privileges for the role: CREATE TABLE, CREATE TRIGGER, CREATETYPE, DEBUG ANY PROCEDURE, SELECT ANY DICTIONARY.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    40/54

    12.

    Click the SQL tab to view the SQL statement generated by your choices.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    41/54

    Then click Apply.

    13.

    Click OK .

    14.

    View and verify the DEV_ROLE in the DBA Navigator.

    Expand System > Security > Roles > DEV_ROLE > Granted System Privileges.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    42/54

    15.

    Next, you grant the DEV_ROLE role to the HR and HRADMIN Users.

    In the DBA Navigator, Expand System > Security > Users. Right-click HR and select GrantRole.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    43/54

    Click Apply.

    16.

    Click OK .

    Follow the same steps to grant the DEV_ROLE to the HRADMIN user.

    Viewing and Modifying Storage Information

    With Oracle SQL Developer 3.0 you can examine, monitor and maintain the databasestorage files. The files fall into the categories of archive logs, control files, data files, redolog groups, rollback segments, tablespaces, and temporary tablespace groups.

    In this topic, you learn to view and edit the properties of the data file.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    44/54

    1 . To view the data files, expand Storage and select Datafiles .

    2 . In the window to the right of the DBA Navigator, you can view the details of each data file. This

    includes the operating system file name, the tablespace the file is associated with, the status, thesize, how much is used, the used percentage and used proportion, and whether auto extend isturned on.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    45/54

    3 . You can turn the Autoextend properly on and off for a data file.

    To modify the properties of a data file, right-click the data file you want to edit and select Edit.For example right-click C:\APP\PVTRIVED\ORADATA\ORCL\SYSTEM01.DBF and selectEdit .

    Note: The path to the file will be different on your system.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    46/54

    4 . Deselect Automatically Extend When Full .

    By doing this, you are limiting the file size to 706568 KB.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    47/54

    5 . Click Apply .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    48/54

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    49/54

    8 . Observe that the status of Auto Extend is updated to NO .

    Creating a Tablespace

    A tablespace is a database storage unit that groups related logical structures together. Thedatabase data files are stored in tablespaces.

    In this topic, you learn to create a tablespace and add a data file in it.

    1 . Right-click Tablespaces and select Create New .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    50/54

    2 . To add a data file, click File Specifications .

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    51/54

    3 . Click to add the file name.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    52/54

    4 . Enter File Name as TEMP01 and click OK .

    Note: Choose an existing data file.

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    53/54

  • 7/27/2019 Working with the Oracle SQL Developer 3.docx

    54/54

    Summary

    In this tutorial, you have learned how to:

    Create a database connection. Access the DBA Navigator. View and edit database features. Set audit privileges.