7 Replies Latest reply on Jun 8, 2012 11:35 AM by Fred Breton

    User Mapping

    Siddu angadi

      I have Created Package which executing some SQL scripts.

      The Role, which I logged in to Bladelogic is mapped to ‘oracle’ user under Role-->Agent ACL.

      When I Deploy BLPackage, the commands are getting failed. However if I execute the shell script manually on the server with ‘oracle’ uid, it executed successfully.

      My questions are:

      1. How the user map (under Agent ACL) works in Bladelogic?
      2. If I execute anything, does Bladelogic use the user (UID) which mapped under Agent ACL?

       

       

      Version:  BMC Server Automation 8.2

      Target Machine Platform:   Linux Redhat

       

      Thanks

      Siddu

        • 1. Re: User Mapping

          your're mapped to the user but your script is executed as if you execute it from a cron which means without your user profile has run, so you've not your env variables. To do so,  source .bash_profile at the beginning of your script.

          • 2. User Mapping
            Siddu angadi

            Hi Fred,

             

            is this below code right one?

             

            --------------------------------------------------------------------------------------------------

             

            #!/bin/sh
            source .bash_profile
            USERNAME='system'

            PASSWORD='manager'
            DB_NAME='test_db'

            ORAENV_ASK=NO

            ORACLE_SID=$DB_NAME

            export $ORACLE_SID

            id

            . oraenv

            cd /tmp/SQL_SCRIPT/test1

            sqlplus $USERNAME/$PASSWORD << EOF > /tmp/output.log
            @deployment.sql;
            exit;
            EOF

             

             

            ----------------------------------------------------------------------------------------------------

            • 3. User Mapping

              I guess source should be good. I more use following syntaxe:

              . .bash_profile

               

              Then you not sure your ORACLE_SID will be what you expect as after its declaration you source oraenv which should define ORACLE_SID...

              • 4. Re: User Mapping
                Siddu angadi

                Hi Fred ,

                 

                Still My job is getting failed.

                 

                Let me explain you clearly. I need execute deployment.sql script on the database server with userid 'oracle123'.

                 

                What actualy I have followed:

                 

                1. I have created role called ORACLE_ADMIN and maped to 'oracle123' user under Agent ACL.
                2. I have created BLPackage and imported both deployment.sql and ShellScript to execute this SQL file. ( I have attached shell script here)
                3. I have added external command to BLPackage. External command is as below:

                         ./tmp/SQL_SCRIPT/ShellScript.sh

                 

                When i execute it is getting failed.

                 

                Am I following proper method?

                 

                 

                Thanks

                Siddu

                • 5. Re: User Mapping

                  After step 1, did you pushed the ACLs on the agent?

                  Could you run the deploy job with full log setup to all information and provide the result?

                  Thanks.

                  • 6. Re: User Mapping
                    Siddu angadi

                    Hi Fred,

                     

                    There was problem on Agent ACL pushed. Now it is resolved and it is working fine.

                     

                    Thanks

                    Siddu

                    • 7. Re: User Mapping

                      You're wellcome.