> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ALTER JOB

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `ALTER JOB` statement transfers ownership of a <InternalLink path="show-jobs">job</InternalLink> between <InternalLink path="create-user">users</InternalLink> or <InternalLink path="create-role">roles</InternalLink>.

## Required privileges

To alter job ownership, the user must be one of the following:

* The current job owner.
* A member of the role that is the current owner.
* An `admin`.

Unless the user is an `admin`, they can only transfer ownership of a job to themselves or to a role of which they are a member.

To add a user to a role, refer to the <InternalLink path="grant">`GRANT`</InternalLink> statement.

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/URZZsrJ2y-tKyo7i/images/sql-diagrams/v25.1/alter_job.svg?fit=max&auto=format&n=URZZsrJ2y-tKyo7i&q=85&s=0ab68f1dcd068925c485474cae74e614" alt="alter_job syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="523" height="37" data-path="images/sql-diagrams/v25.1/alter_job.svg" />

### Parameters

| Parameter   | Description           |
| ----------- | --------------------- |
| `a_expr`    | The job ID to modify. |
| `role_spec` | The role or user.     |

## Example

To transfer job ownership from the user who created the job to a role they're a member of:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
ALTER JOB job_id OWNER TO role_name;
```

## See also

* <InternalLink path="show-jobs">`SHOW JOBS`</InternalLink>
* <InternalLink path="pause-job">`PAUSE JOB`</InternalLink>
* <InternalLink path="resume-job">`RESUME JOB`</InternalLink>
* <InternalLink path="cancel-job">`CANCEL JOB`</InternalLink>
