SQL

I have put in my best efforts to ensure the task's completion meets the expected standards and aligns with the desired outcomes. I have also attached any relevant documents, reports, or deliverables associated with the task for your convenience.

Should you require any further information or clarification regarding the completed task, please do not hesitate to reach out to me. I am available to discuss any aspects in more detail or provide additional support as needed.

Thank you for entrusting me with this task. I look forward to your feedback and guidance on the next steps or any revisions required.


SELECT (SELECT COUNT(*) FROM USER_TABLES) AS table_count, (SELECT COUNT(*) FROM USER_VIEWS) AS view_count, (SELECT COUNT(*) FROM USER_INDEXES) AS index_count FROM DUAL;

SELECT 
    (SELECT COUNT(*) FROM USER_TABLES) AS table_count,
    (SELECT COUNT(*) FROM USER_VIEWS) AS view_count,
    (SELECT COUNT(*) FROM USER_INDEXES) AS index_count,
    (SELECT COUNT(*) FROM USER_TABLES) + (SELECT COUNT(*) FROM USER_VIEWS) + (SELECT COUNT(*) FROM USER_INDEXES) AS total_count
FROM DUAL;


#!/bin/bash

# Oracle Database Parameters Comparison Script

# Specify the Oracle home directory
ORACLE_HOME="/path/to/oracle/home"

# Specify the database instances to compare
DB_INSTANCES=("instance1" "instance2" "instance3")

# Specify the output file
OUTPUT_FILE="parameter_comparison.txt"

# Function to compare the parameters of two instances
compare_parameters() {
  local instance1=$1
  local instance2=$2
  
  echo "Comparing parameters for $instance1 and $instance2"
  
  # Get the parameter values for instance1
  $ORACLE_HOME/bin/sqlplus -S "/ as sysdba" <<EOF >instance1_parameters.txt
  set pagesize 0
  set feedback off
  select name, value from v\$parameter;
  exit;
EOF

  # Get the parameter values for instance2
  $ORACLE_HOME/bin/sqlplus -S "/ as sysdba" <<EOF >instance2_parameters.txt
  set pagesize 0
  set feedback off
  select name, value from v\$parameter;
  exit;
EOF

  # Compare the parameter values
  diff -u instance1_parameters.txt instance2_parameters.txt >>$OUTPUT_FILE
}

# Main script

# Clear the output file
echo >$OUTPUT_FILE

# Compare parameters for each pair of instances
for ((i = 0; i < ${#DB_INSTANCES[@]}; i++)); do
  for ((j = i + 1; j < ${#DB_INSTANCES[@]}; j++)); do
    compare_parameters "${DB_INSTANCES[$i]}" "${DB_INSTANCES[$j]}"
  done
done

# Clean up temporary files
rm instance1_parameters.txt instance2_parameters.txt

echo "Parameter comparison completed. Results are stored in $OUTPUT_FILE"


stages:
  - check_vm_status

check_vm_status:
  stage: check_vm_status
  image: mcr.microsoft.com/azure-cli:latest
  script:
    - az login --service-principal -u $AZURE_CLIENT_ID -p $AZURE_CLIENT_SECRET --tenant $AZURE_TENANT_ID
    - vm_status=$(az vm show --resource-group your-resource-group --name your-vm-name --query powerState -o tsv)
    - echo "VM status: $vm_status"



Comments

Popular posts from this blog

Java Practice Questions MCQ

HackerRank Introduction Challenges - Java