How to run scheduled Azure SQL Procedure

How to run scheduled Azure SQL Procedure
Azure Automation with runbook

1.Problem

Azure Managed SQL 에서는 설치형 MSSQL DB와 달리 스케줄 잡을 실행할 수 없습니다.

참고: https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/job-automation-managed-instance?view=azuresql

2.Solution

Azure Automation AccountPowerShell 로 DB Procedure 실행하는 Job을 등록해서 매일 특정시간에 동작하게 하면 됩니다. 이 외에도 Azure Function을 만들어 주기적으로 실행하는 방법도 있지만 Microsoft 제품인 만큼 생산성을 위해 파워셸을 사용해 간단한 코드로 해결하였습니다.

Write-Output "Run started"

# Instantiate the connection to the SQL Database

$sqlConnection = new-object System.Data.SqlClient.SqlConnection


$sqlConnection.ConnectionString = "Data Source=servername.database.windows.net;Initial Catalog=database;Integrated Security=False;User ID=userid;Password=password;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False"


$sqlConnection.Open()


Write-Output "Azure SQL database connection opened"


# Define the SQL command to run

$sqlCommand = new-object System.Data.SqlClient.SqlCommand

$sqlCommand.CommandTimeout = 120

$sqlCommand.Connection = $sqlConnection


Write-Output "Issuing command to run stored procedure"


# Execute the SQL command

$sqlCommand.CommandText= 'exec [dbo].[storedProcedure]'

$result = $sqlCommand.ExecuteNonQuery()


Write-Output "Stored procedure execution completed"


# Close the SQL connection

$sqlConnection.Close()


Write-Output "Run completed"

참고: https://global.hitachi-solutions.com/blog/azure-sql-databases-stored-procedure/

Read more

React native Webview 안드로이드 로그인 유지

증상 * 안드로이드 앱에서 로그인 유지가 의도한 것 보다 짧게 유지 되거나 로그인 정보가 날라가는 오류가 있었습니다 원인 * 로그인 인증을 위한 쿠키가 메모리에서 디스크로 이동하는데 일정 간격이 있어서 실시간으로 동기화 되지 않았기 때문입니다 조치 * 안드로이드에서 쿠키를 디스크(영구 저장소)로 저장하는 메소드를 앱이 백그라운드로 이동할 때 호출하여 해결하였습니다 * React native의 쿠키관리

By Taehwan Go
기술 뉴스, 2025.1.20

기술 뉴스, 2025.1.20

남부끄러운 코드와 이상한 애플리케이션이 생기는 이유 https://www.itworld.co.kr/article/3803555/남부끄러운-코드와-이상한-애플리케이션이-생기는.html 도커와 OCI 컨테이너를 사용해야 하는 이유 https://www.itworld.co.kr/article/3803638/도커와-oci-컨테이너를-사용해야-하는-이유.html 크로스 플랫폼 앱을 만들 때 명심할 4가지 https://www.itworld.co.kr/article/3631944/크로스-플랫폼-앱을-만들-때-명심할-4가지.html AI 코딩 어시스턴트, 시니어

By Hyonsok
ISACA 2024 학술대회 발표자료

ISACA 2024 학술대회 발표자료

ISACA_2024_공동_학술대회_발표자료ISACA_2024_공동_학술대회_발표자료.pdf125 MBdownload-circle[2024. 11. 20.] 연세대, 2024 바른ICT연구소 리서치 콘퍼런스 성료 | 연세대학교연세대학교 * 키워드 * 데이터 * 신뢰 * 윤리 * 보안 * 2024 노벨상 * 물리학상, 제프리 힌튼 (인공지능, 컴퓨터 과학자) * 화학상, 데미스 허사비스 (구글 딥마인드) * 라인 경영권 이슈 * 데이터 주권 확보에 대한 노력 (경영권 분쟁이 아님.

By Hyonsok