Grant access to create/alter/drop/ to tables, view, index

Using (Transact-sql) SQL query analyser 8.00.2039
Objective: To delete/drop the schema on every run of database setup (i mean drop the schema and build it on every run).
I have done the following to accomplish the same ...
Logged in as sa ... i did the following
use master
exec sp_addlogin 'sas'
exec sp_adduser 'sas'
create database ss
use ss
exec sp_grantdbaccess 'sas', 'ss'
i am having issues with the grant command in the above version.
i want to grant create table, create index, create view, alter table, drop view, drop index, drop table to the user sas
When i ran the command
grant create table, create index, create view, alter table, drop view, drop index, drop table to sas
i got
Server: Msg 165, Level 16, State 6, Line 1
Privilege CREATE INDEX may not be granted or revoked.
Server: Msg 165, Level 16, State 1, Line 1
Privilege ALTER TABLE may not be granted or revoked.
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'delete'.
If the grant worked, i thought of creating the schema like
create schema epp authorization sas
Then for removing the schema (as there is no drop schema command for the version mentioned above)
i would have done this,
use master
exec sp_revokedbaccess 'sas'
alter database ss set single_user with rollback immediate
drop database ss
exec sp_droplogin 'sas'
I referred the online book but not of much help on this.
Is this is the correct way to drop/delete a schema on every run of database setup
pls. offer your suggestions

Terminology.
When you write “schema” I will guess that you mean ‘database ‘rather than a security schema within a database.
User.
A user is an object that belongs to a database. In your create code you added the user sas to the master database. If you want to add that user to the ss database you have to create the ss database first, then USE database ss; before you sp_adduser. If you are using SQL Server 2005 use CREATE User not sp_adduser.
To DROP a database you DROP the database. All the objects in the database including its users are dropped with it. The Logins belong to the server and they can be dropped before or after you drop the database though if you drop a Login and don’t drop a database that has that Login as a User you orphan the User.

Similar Messages

  • Database objects Tables, Views, Indexes not expand in Connections navigator

    In SQL Developer tool when I clicked on any database object: Tables, Views, Indexes, Packages, Procedures, Functions, and Triggers none of them expands in Connections navigator so I am not able to see all tables, Views, Indexes in this schema objects.
    Please advise
    Thanks a lot
    Vincent

    If the user you're connecting with is not the owner of the objects, you can access them through the Other Users node.
    Hope that helps,
    K.

  • Access the nodes data in a table view (generated by aet).

    Hi all ,
    I have created a table view in bp overview page.
    so it has created new component /ztable/zbol entity .
    Now how can i access the nodes of BP page..in the new component created?.

    thanks vishal ,
    but as per the thread,when we create table view using aet ,
    Table view in EHP1 CRM 7.0
    You dont need to worry about the component usage nor you need to create or handle anything like that for AET compoent for table extension. SAP has a special way to handle it in WD_USAGE_INITIALIZE of component controller for AET extension generated component so its nothing for us to do about it. Thanks to SAP
    so still i need to redefine..or can directly access the nodes in do_prepare_output.?

  • Creating subtotal in a table view

    Hi All,
    Can I create a subtotal in a Table view based on particular column? Any help would be appreciated.
    Thanks in advance,
    RK

    Hi,
    I am using Siebel Analytics 7.5 version, I don't see the ∑ symbol on the column options (along with filter, properties, sorting, etc.). Is this feature is not available in this version.
    Thanks in advance,
    RK

  • Create/Drop/Compile Table, Views, Triggers, Sequences, etc.

    Is there a way to create, drop, and compile objects on an Oracle database with the ADF library? If so, any good examples?
    Can the results be captured as well?

    Frank,
    Maybe I wasn't clear enough. The only example I saw that involved the blob column was number 85 which did not contain info for database maintance.
    I have a JClient application that reads database structures like triggers, tables, and views. I would like the user to be able to push a button and the trigger be compiled in the database. While SQL Dev probably has more features and does a better job I have added a bunch of internal stuff that would have to be manually added in SQL Dev each time a new trigger was created.
    Is there a way, when working with the current transaction(or new transaction), to issue a statement like you would in SQL*Plus "DROP TABLE EMPLOYEES;" with the results being "TABLE DROPPED"?
    thanks.

  • How to remove tables, views, index installed during installation

    Here is the statement I'm using for a college class to show the content of the catalog. However when ran it outputs 1346 lines of data of which 90% are files loaded during installtion.
    select substr(object_name, 1, 20), object_type, status
    from user_objects
    SPOOL OFF
    Partial results of SQL statement.
    SUBSTR(OBJECT_NAME,1 OBJECT_TYPE STATUS
    MGMT_JOB_CALLBACKS TABLE VALID
    PK_MGMT_JOB_CALLBACK INDEX VALID
    MGMT_JOB_QUEUES TABLE VALID
    PK_JOB_QUEUE INDEX VALID
    MGMT_JOB_BLACKOUT_AS TABLE VALID
    PK_MGMT_JOB_BLACKOUT INDEX VALID
    MGMT_JOB_SEQUENCE SEQUENCE VALID
    MGMT_PERFORMANCE_NAM TABLE VALID
    MGMT_PERFORMANCE_NAM INDEX VALID
    MGMT_SYSTEM_ERROR_LO TABLE VALID
    MGMT_SYSTEM_PERFORMA TABLE VALID
    How can I wipe the database clean so that only my data is there?
    Thanks

    You can come up with a script as follows, which is an example.
    declare
    cursor cursor1 is select owner,object_name,object_type from dba_objects where owner=' user560741';
    ddlsql varchar2(100);
    begin
    for cur1_rec in cursor1 loop
    if (cur1_rec.object_type like 'TABLE') then
    ddlsql:='drop ' || cur1_rec.object_type || ' ' || cur1_rec.owner||'.'||cur1_rec.object_name ||' cascade constraint';
    else
    ddlsql:='drop ' || cur1_rec.object_type || ' ' || cur1_rec.owner||'.'||cur1_rec.object_name;
    end if;
    begin
         execute immediate ddlsql;
    exception
    when others then
         ddlsql:='';
    end;
    end loop;
    end;
    /

  • Grant access to specfic schema

    Is there any way that these permissions could be created without the ANY clause?
    CREATE ANY CONTEXT
    DROP ANY CONTEXT
    EXECUTE ANY PROCEDURE
    EXECUTE ANY TYPE
    I got access to only one schema ..Client side DBA are not permitting access to "ANY" clause but they are ready to grant access like create context, drop context etc ..Is there any access like CREATE CONTEXT, DROP CONTEXT,EXECUTE PROCEDURE,EXECUTE TYPE for to give access to one user alone..etc ???
    Advice me on this !!
    Regards
    dkoracle

    Pl post details of OS and database versions.
    Have you read the documentation ?
    http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/statements_5002.htm#i2060927
    http://download.oracle.com/docs/cd/E11882_01/server.112/e26088/statements_8008.htm#i2099532
    If so, what have you found ?
    If not, I think it is time to read up !
    Srini

  • How to trace a user who entered/dropped a table in a shared DataBase

    Hai, I have a doubt plz help me
    when working in a shared DataBase environment, different users will create or drop
    tables from the DataBase. Is it possible to trace who has created/altered a particular table in the DB. If yes plz tell me the procedure.
    Thanks in advance.
    SrihariKrishna

    Maybe this link provides some help?
    http://asktom.oracle.com/pls/ask/f?p=4950:8:5395923770553724381::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:6399608034075
    C.

  • Getting a list of all table and index names

    Hi,
    I have just create a set of tables and indexs, but I have misspelt on of the table names and am now trying to find out what it is. I am using sql*plus as a command line interface but can only find desc as a way of finding any data on a table. What is the command to list all the tables within a table space?
    Cheers
    Simon

    Hi,
    there are almost always three ways to find things in Oracle's dictionary :
    USER_xxx = thing that you own
    ALL_xxx = thing that you own and have access to
    DBA_xxx = all things in hole database
    If you want to find tables/indexes that you own :
    SELECT table_name FROM user_tables
    WHERE tablespace_name = 'APP_TBS';
    SELECT index_name FROM user_indexes
    WHERE tablespace_name = 'APP_TBS';
    /Uffe

  • In table view, how to add one button for selecting page?

    Hi Experts,
    In the OBIEE 11.1.1.6, we have one uncommon requirement that customers want to randomly select actual page to view expected data in table view.
    For example:
    We make use of some columns to create one report in table view, and set 'Rows per Page' equal to '5',
    if this report contains 60 rows, it will have 12 pages, so customers want to select sepcial page number to view the some data. Is it possible to implement this requirement? Maybe we should write JS code.
    Note: Below table view, it has four buttons: First Row, Previous Row, Next Row and Display (500) rows in per page. So we want to add one button to select per page.
    We look at orgnial codes in WebBrowse, but do not know the following codes derive from which JS file.
    Could you please tell me how to find this file?
    <td class="TapeDeckCell"><img class="TapeDeckImage" onclick="" onkeypress="" src="res/s_blafp/viewui/pivot/first_dis.png" title="" alt="" ><img class="TapeDeckImage" onclick="" onkeypress="" src="res/s_blafp/viewui/pivot/previous_dis.png" title="" alt="" ><img class="TapeDeckImageEna" onclick="PTRowScroll('saw_5083_b','5','5', event)" onkeypress="PTRowScroll('saw_5083_b','5','5', event)" src="res/s_blafp/viewui/pivot/next_ena.png" tabIndex="0" onmouseover="PTTD(event, 'res/s_blafp/viewui/pivot/next_ovr.png');" onmouseout="PTTDO(event)" onmousedown="PTTD(event, 'res/s_blafp/viewui/pivot/next_dwn.png');" title="Next 5 Rows" alt="Next 5 Rows" ><img class="TapeDeckImageEna" onclick="*PTRowScroll*('saw_5083_b','-1)', event)" onkeypress="PTRowScroll('saw_5083_b','-1)', event)" src="res/s_blafp/viewui/pivot/showallrows_ena.png" tabIndex="0" onmouseover="PTTD(event, 'res/s_blafp/viewui/pivot/showallrows_ovr.png');" onmouseout="PTTDO(event)" onmousedown="PTTD(event, 'res/s_blafp/viewui/pivot/showallrows_dwn.png');" title="Display maximum (500) rows per page" alt="Display maximum (500) rows per page" > <Span class="TapeDeckRecords">Rows 1 - 5</Span></td>

    Hi Kobe,
    Thanks for listening me.
    I agree 11g have some issues unlike 10g. I've tried the same by creating a measure rcount(1) and name it as Page in RPD. I just pulled column Page in pivot table section 'Pivot Table Prompts' it is working but this may not answer your requirements.
    I would suggest to use the column in Prompt and go by between operator to allow user to select the rows between.
    In the report make Page as prompted.
    If you are okay with this can look forward to tweak it further, like values in the prompt multiple of 5 or 10s some thing like that.
    let me know updates on the same.

  • Cannot INSERT records into Partitioned Spatial Table and Index

    I am trying to tune our Spatial Storage by creating partitioning our spatial_entity table and index. I used the World Geographic Reference System (GEOREF) creating a partition for each 15 x 15 degree grid square assigning a partition key of decimal longitude, decimal_latitude. The build went OK, however when trying to insert a data record I receive an ORA-14400: Inserted partition key does not map to any partition.
    I validated the CREATE(s), and all appears correct, but obviously something is not correct, which is prompting for expert help in this forum.
    I would be very grateful for your help.
    Below are the code snippets for the table and index, and an insert statement.
    CREATE TABLE spatial_entity
         geoloc_type VARCHAR2 (60 BYTE) NOT NULL
    ,entity_id NUMBER NOT NULL
    ,metadata_xml_uuid VARCHAR2 (40 BYTE) NOT NULL
    ,geoloc MDSYS.sdo_geometry NOT NULL
    ,nee_method CHAR (1 BYTE) NOT NULL
    ,nee_status CHAR (1 BYTE) NOT NULL
    ,decimal_latitude NUMBER (15, 6) NOT NULL
    ,decimal_longitude NUMBER (15, 6) NOT NULL
    PARTITION BY RANGE (decimal_longitude, decimal_latitude)
         PARTITION p_lt_0_90s
              VALUES LESS THAN (1, -90)
         ,PARTITION p_lt_0_75s
              VALUES LESS THAN (1, -75)
         ,PARTITION p_lt_0_60s
              VALUES LESS THAN (1, -60)
         ,PARTITION p_lt_0_45s
              VALUES LESS THAN (1, -45)
         ,PARTITION p_lt_0_30s
              VALUES LESS THAN (1, -30)
         ,PARTITION p_lt_0_15s
              VALUES LESS THAN (1, -15)
         ,PARTITION p_lt_0_0
              VALUES LESS THAN (1, 0)
         ,PARTITION p_lt_0_15n
              VALUES LESS THAN (1, 15)
         ,PARTITION p_lt_0_30n
              VALUES LESS THAN (1, 30)
         ,PARTITION p_lt_0_45n
              VALUES LESS THAN (1, 45)
         ,PARTITION p_lt_0_60n
              VALUES LESS THAN (1, 60)
         ,PARTITION p_lt_0_75n
              VALUES LESS THAN (1, 75)
         ,PARTITION p_lt_0_90n
              VALUES LESS THAN (1, maxvalue)
    CREATE INDEX geo_spatial_ind ON spatial_entity (geoloc)
    INDEXTYPE IS mdsys.spatial_index
    PARAMETERS ('layer_gtype=MULTIPOINT TABLESPACE=GEO_SPATIAL_IND') LOCAL
    (PARTITION p_lt_0_90s,
    PARTITION p_lt_0_75s,
    PARTITION p_lt_0_60s,
    PARTITION p_lt_0_45s,
    PARTITION p_lt_0_30s,
    PARTITION p_lt_0_15s,
    PARTITION p_lt_0_0,
    PARTITION p_lt_0_15n,
    PARTITION p_lt_0_30n,
    PARTITION p_lt_0_45n,
    PARTITION p_lt_0_60n,
    PARTITION p_lt_0_75n,
    PARTITION p_lt_0_90n,
    INSERT INTO spatial_entity
         geoloc_type
         ,entity_id
         ,metadata_xml_uuid
         ,geoloc
         ,nee_method
         ,nee_status
         ,decimal_latitude
         ,decimal_longitude
    VALUES
                   'BATCH'
                   ,0
                   ,'6EC25B76-8482-4F95-E0440003BAD57EDF'
                   ,"MDSYS"."SDO_GEOMETRY"
                        2001
                        ,8307
                        ,"MDSYS"."SDO_POINT_TYPE" (32.915286, 44.337902, NULL)
                        ,NULL
                        ,NULL
                   ,'M'
                   ,'U'
                   ,32.915286
                   ,44.337902
    Thank you for you help.
    Dave

    Thank you for your quick reply. I did not post the entire CREATE script as it is quite long. The portion of the script that is applicable to the INSERT is:
    ,PARTITION p_lt_45e_90s
              VALUES LESS THAN (23, -90)
         ,PARTITION p_lt_45e_75s
              VALUES LESS THAN (23, -75)
         ,PARTITION p_lt_45e_60s
              VALUES LESS THAN (23, -60)
         ,PARTITION p_lt_45e_45s
              VALUES LESS THAN (23, -45)
         ,PARTITION p_lt_45e_30s
              VALUES LESS THAN (23, -30)
         ,PARTITION p_lt_45e_15s
              VALUES LESS THAN (23, -15)
         ,PARTITION p_lt_45e_0
              VALUES LESS THAN (23, 0)
         ,PARTITION p_lt_45e_15n
              VALUES LESS THAN (23, 15)
         ,PARTITION p_lt_45e_30n
              VALUES LESS THAN (23, 30)
         ,PARTITION p_lt_45e_45n
              VALUES LESS THAN (23, 45)
         ,PARTITION p_lt_45e_60n
              VALUES LESS THAN (23, 60)
         ,PARTITION p_lt_45e_75n
              VALUES LESS THAN (23, 75)
         ,PARTITION p_lt_45e_90n
              VALUES LESS THAN (23, maxvalue)
    Or, I do not fully understand. Are you indicating that I must explcitly state the longitude in each clause,
    e.g ,PARTITION p_lt_45e_45n
              VALUES LESS THAN (45, 45)
    ,PARTITION p_lt_45w_45n
              VALUES LESS THAN (-45, 45)
    If so, that answers the question of why it cannot find a partition, however an Oracle White Paper "Oracle Spatial Partitioning Best Practices" Sept 2004, discusses multi column partitioning such as represented by this problem, and gives an INSERT statement example of :
    CREATE TABLE multi_partn_table (in_date DATE,
    geom SDO_GEOMETRY, x_value NUMBER, y_value NUMBER)
    PARTITION BY RANGE (X_VALUE,Y_VALUE)
    PARTITION P_LT_90W_45S VALUES LESS THAN (1,-45),
    PARTITION P_LT_90W_0 VALUES LESS THAN (1,0),
    PARTITION P_LT_90W_45N VALUES LESS THAN (1,45),
    PARTITION P_LT_90W_90N VALUES LESS THAN (1,MAXVALUE
    and as I am writing this I am seeing that I failed to include the longitude and latitude in the SDO_GEOMETRY clause, so it does appear tht I need to explicitly state the longitude valuues.
    What is your judgement sir?
    Dave

  • JavaFX table view headers bug?

    Hi,
    I created simple application with table view and I have problem with the way that table view headers are displaying.
    When table view is not focused headers are improper width but when table get focus then headers width is changing and everything is working as expected.
    Before table view get focus:
    http://imageshack.us/a/img841/6853/j9u9.png
    After table view get focus:
    http://imageshack.us/a/img43/922/169f.png
    Best regards,
    Lukas

    You should run this app without problems becouse it is embeded SQLLite databse. Look into SqlLiteDB class. You can even delete database.db file becouse sqllite driver will automatically create database.
    I check your example and is perfect becouse is showing my issue You should only make small change that you skipped: ( table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); )
    import javafx.application.Application;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Insets;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.TextField;
    import javafx.scene.control.cell.MapValueFactory;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.HBox;
    import javafx.stage.Stage;
    import java.util.*;
    public class Main extends Application {
        @Override
        public void start(Stage primaryStage) {
            final AnchorPane root = new AnchorPane();
            root.setPadding(new Insets(10));
            final HBox controls = new HBox(5);
            final Button getDataButton = new Button("load data");
            final TextField textField = new TextField();
            final TableView<Map> table = new TableView<>();
            table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
            getDataButton.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent event) {
                    DataSource dataSource = new DataSource();
                    table.getColumns().clear();
                    table.getColumns().addAll(dataSource.getTableColumns());
                    table.setItems(dataSource.getQueryResult());
            controls.getChildren().addAll(getDataButton, textField);
            AnchorPane.setTopAnchor(controls, 10.0);
            AnchorPane.setLeftAnchor(controls, 10.0);
            AnchorPane.setRightAnchor(controls, 10.0);
            AnchorPane.setTopAnchor(table, 45.0);
            AnchorPane.setRightAnchor(table, 10.0);
            AnchorPane.setLeftAnchor(table, 10.0);
            AnchorPane.setBottomAnchor(table, 10.0);
            root.getChildren().addAll(controls, table);
            primaryStage.setScene(new Scene(root, 1000, 1000));
            primaryStage.show();
        public static class DataSource {
            public List<TableColumn<Map, Object>> getTableColumns() {
                TableColumn<Map, Object> idColumn = new TableColumn<>("ID");
                idColumn.setCellValueFactory(new MapValueFactory<Object>("ID"));
                TableColumn<Map, Object> nameColumn = new TableColumn<>("NAME");
                nameColumn.setCellValueFactory(new MapValueFactory<Object>("NAME"));
                return Arrays.asList(idColumn, nameColumn);
            public ObservableList<Map> getQueryResult() {
                List<Map> result = new ArrayList<>();
                for (int i = 0; i < 200; i++) {
                    Map<String, Object> row = new HashMap<>();
                    row.put("ID", i);
                    row.put("NAME", "Name " + i);
                    result.add(row);
                return FXCollections.observableArrayList(result);
        public static void main(String[] args) {
            launch(args);

  • Two table views in single screen

    Hi,
    are we able to put two Table views in one UI window?
    My requirement is if i click on one cell on 1st table view then 2nd table view cell's in the same UI window has to be updated with required values.
    is that possible?
    Please let me know the solution if anyone know.
    Thanks in advance.

    Just go to interface builder and drop two table views in.
    Presto! You're done.

  • Can database activities of creating or dropping tables/packages be tracked in the security/system logs

    Can database activity like create or drop tables and packages be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Can purging of oracle log, n case the file has become big or even tempered be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?

    2765539 wrote:
    Can database activity like create or drop tables and packages be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Can purging of oracle log, n case the file has become big or even tempered be tracked in the security/system logs of windows 2003 server for the oracle database 10.2.0.4?
    Your first question is easy, you configure audit to log to the OS audit trail with
    alter system set audit_trail=os scope=spfile;
    and then enable audit for whatever actions you want to capture. All documented in the Security Guide.
    Your second question makes no sense unless you explain what you mean by "oracle log".

  • Grant access to all the views created in user schema to another schema

    How to grant access for all the views created in own HAGGIS schema to comqdhb schema on the HAGGIS database.
    Oracle Grant Privileges
    ===============
    Object privileges assign the right to perform a particular operation on a specific object
    I read that we can use select 'grant select on' ||view_name||'HAGGIS' user_views where owner='COMQDHB'
    Is this right
    Oracle System Privileges
    ===============
    System privileges should be used in only cases where security isnt important,because a single grant statement could remove all security from the table
    Role based security
    ============
    Role security allows you to gather related grants into a collection-since the role is a predefined collection of privileges that are grouped together.privileges are easier to assign to users.
    [http://www.dba-oracle.com/art_builder_grant_sec.htm]
    can we grant select update to all the views at a time to the other schema.
    Are there any other ways to secure the data other than creating users and assigning roles.
    Thank you
    Edited by: Trooper on Dec 23, 2008 9:24 AM

    I think what was suggested was that you use SQL to generate the grants on each and every view, that is, you use SQL to generate SQL where the SQL being generated is "grant select on view_name to role'"
    If you users to connect to Oracle you have to create usernames for them though if the users only connect via an application the application might run just as one user and access to the application is controled via application security. The control on the application can be via Directory Services such as OID or MS Active Directory. User access to Oracle can also be controlled via OID.
    To connect to Oracle you can use OS authenication (not recommended), usernames with passwords, or via Advanced Security Option which supports single sign-on products like Kebros or Oracle Internet Directory etc....
    Example using SQL to generate SQL
    How do I find out which users have the rights, or privileges, to access a given object ?
    http://www.jlcomp.demon.co.uk/faq/privileges.html
    HTH -- Mark D Powell --

Maybe you are looking for

  • How to update the z-condition type in pricing procedure in a quote

    Hi Gurus, I need your help to solve my issue. I have created a RFC which will trigger any time there is a CRM Quote/ CRM Order create or change occurs. IN response of the RFC i will get the rate and rate type for the line items . When the service  re

  • How to get a refund for an iTunes gift card

    I got an iTunes gift card but can't buy anything on iTunes. How do I go about getting a refund?

  • Pb oracle

    hi ! i get a pb with oracle 9i installed under linux for a long time ago, It was working fine. the instance break down wherewas client are connected. Thanks for help ! here is the trace_log: Wed Oct 10 11:27:37 2007 Errors in file /u01/app/oracle/adm

  • Use of xml files in JSP ??

    I wud like to know the wy we use XML files in JSP's or in any web development applications.

  • I can't add a Hewlett-Packard psc 1200 printer.

    Trying to add hp psc 1200 printer, says software not currently available from the Software Update server.  Any ideas please?